- 1
#3.Write a program to check if the age of a student stored in a tuple is greater than 20 or not
#3.Write a program to check if the age of a student stored in a tuple is greater than 20 or not. #The data stored in the tuple called “student” is the format name, age, qualification, city and values are “Jai”, 20, “Btech”, “Noida”. #Write the code to check the condition - #if the age is greater than 20 print “You are qualified” else print “You are not qualified”
5 Respuestas
+ 2
This is fine, but in line 9, you can directly write
age = Tuple_of_student[1]
Also, line 11 is not necessary. And your question says to use the name "student", so use that instead of "Tuple_of_student"
+ 1
https://code.sololearn.com/cLTliX9ZtljV/?ref=app
Is this attempt is correct?? Satnam Singh
+ 1
You don't have to create an age variable, you can access every element of a tuple by index.
if Tuple_of_student[1] >20:
...
(Index counting starts with 0.)
+ 1
Thank you HonFu
0
Anyone help on this... Kishalaya Saha