Q. Write a program to create a nested tuple to store roll number, name and marks of students.


You can understand by Watching video :-



Answer = 

 

tup= ()

while True :
      roll = int(input("Enter a roll number :- "))
      name = input("Enter name :-")
      mark = input("Enter marks :-")
      tup += ( (roll,name,mark ),)
      user = input("Do you want to quit enter yes =")
      if user == "yes":
            print(tup)
            break

Output :-

Enter a roll number :- 1
Enter name :-Path
Enter marks :-98
Do you want to quit enter yes =no
Enter a roll number :- 5
Enter name :-Walla
Enter marks :-95
Do you want to quit enter yes =no.
Enter a roll number :- 7
Enter name :-Portal
Enter marks :-80
Do you want to quit enter yes =no
Enter a roll number :- 8
Enter name :-Express
Enter marks :-70
Do you want to quit enter yes =yes
((1, 'Path', '98'), (5, 'Walla', '95'), (7, 'Portal', '80'), (8, 'Express', '70'))

>>>

3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. What's the role true in this programming ..what does it do!?

    ReplyDelete
    Replies
    1. True is used her so this program run so many times because true is always true mens it is an infinite loop

      Delete
  2. Is the output willl be an infinite loop??

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post