-
How do you describe the contents of the students?
students = [ ("John", 20, "Computer Science"), ("Emily", 22, "Mathematics"), ("Michael", 21, "Physics"), ("Sarah", 19, "Biology") ]
-
What is the output of this program?
students = [ ("John", 20, "Computer Science"), ("Emily", 22, "Mathematics"), ("Michael", 21, "Physics"), ("Sarah", 19, "Biology") ] student = students[0] print(student)
-
What is the output of this code?
students = [ ("John", 20, "Computer Science"), ("Emily", 22, "Mathematics"), ("Michael", 21, "Physics"), ("Sarah", 19, "Biology") ] student = students[0] student_name = student[0] print(student_name)
-
Retrieve John’s major.
students = [ ("John", 20, "Computer Science"), ("Emily", 22, "Mathematics"), ("Michael", 21, "Physics"), ("Sarah", 19, "Biology") ] john_major = students[0][''] print(john_major)
-
Retrieve Sarah’s major.
students = [ ("John", 20, "Computer Science"), ("Emily", 22, "Mathematics"), ("Michael", 21, "Physics"), ("Sarah", 19, "Biology") ] student_major = students[''][2] print(student_major)
-
How do you describe the contents of the students?
students = (["John", "Doe"], ["Jane", "Smith"], ["Mike", "Johnson"])
-
What is the output of this program?
students = (["John", "Doe"], ["Jane", "Smith"], ["Mike", "Johnson"]) student = students[0] print(student)
-
What is the output of this code?
students = (["John", "Doe"], ["Jane", "Smith"], ["Mike", "Johnson"]) student = students[0] student_name = student[0] print(student)
-
Retrieve Jane’s family.
students = (["John", "Doe"], ["Jane", "Smith"], ["Mike", "Johnson"]) jane_family = students[1][''] print(jane_family)
Python Exercises for Tuples
If you’ve faced difficulties with these exercises, take a look at Tuples Module on my Python course.
You can also share ‘Python Tuples’ Exercises on your:
X (Twitter) – Telegram – Linkedin – Facebook – or on your favorite platform…