Practice Python Concepts
Ask the student to input a number and check if it is positive, negative, or zero using if-elif-else.
# Hint: Use input() and int() to get number
# if number > 0 -> print "Positive"
# elif number < 0 -> print "Negative"
# else -> print "Zero"
Ask the student to input marks and check if the student passes (>=35) or fails.
# Hint: Use input() and int() to get marks
# if marks >= 35 -> print "Pass"
# else -> print "Fail"
Ask the student to input a number (1-7) and display the day of the week using match-case.
# Hint: Use match number:
# case 1 -> print "Monday"
# case 2 -> print "Tuesday"
# ...
# case _ -> print "Other Day"
Ask the student to create a list of names and access individual items by index.
# Hint: names = ["Arun", "Hasvanth", "Ayyappan"]
# print first and last item using index
Ask the student to add a new name to the list and remove an existing one using list methods.
# Hint: names.append("NewName")
# names.remove("Ayyappan")
# print(names)
Ask the student to create a list with duplicate numbers and convert it into a set to get unique numbers.
# Hint: nums = [1,2,2,3,3,3]
# unique_nums = set(nums)
# print(unique_nums)
Ask the student to add a number to a set and remove a number from it.
# Hint: my_set = {1,2,3}
# my_set.add(4)
# my_set.remove(2)
# print(my_set)
Ask the student to create a dictionary of student marks and access values using keys.
# Hint: marks = {"Arun":45, "Hasvanth":50, "Ayyappan":38}
# print marks of Arun and Ayyappan
Ask the student to update an existing key and add a new key-value pair in the dictionary.
# Hint: marks["Arun"] = new_value
# marks["NewStudent"] = value
# print(marks)
Ask the student to check whether a specific key exists in the dictionary and print a message.
# Hint: if "Arun" in marks:
# print("Arun exists")
# else:
# print("Not found")