-
What is the output of this program?
students = (["John", "Doe"], ["Jane", "Smith"], ["Mike", "Johnson"]) def print_student_info(students, student_index): print('Student name:', students[student_index][0]) print('Student lastname:', students[student_index][1]) print_student_info(students, 2)
-
What is the output of this program?
students = (["John", "Doe"], ["Jane", "Smith"], ["Mike", "Johnson"]) def print_student_info(students, student_index): print('Student name:', students[student_index][0]) print('Student lastname:', students[student_index][1]) print_student_info(students, 0)
-
What is the output of this code?
students = [ ("John", 20, "Computer Science"), ("Emily", 22, "Mathematics"), ("Michael", 21, "Physics"), ("Sarah", 19, "Biology") ] def print_student_info(students, i): print('Name:', students[i][0]) print('Age:', students[i][1]) print('Major:', students[i][2]) print_student_info(students, 2)
-
What is the output of this program?
students = [ ("John", 20, "Computer Science"), ("Emily", 22, "Mathematics"), ("Michael", 21, "Physics"), ("Sarah", 19, "Biology") ] def print_students_info(students): for student in students: print('Name: ', student[0]) print('Age: ', student[1]) print('Major: ', student[2]) print('---------------------') print_students_info(students)
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…