Q. Write a program to accept values from a user in a tuple. Add a tuple to it and display its elements one by one. Also display its maximum and minimum value.
Answer =
tup = eval(input("Enter a tuple :-")) for i in tup : print(i) print(tup) print("maximum value :- ", max(tup)) print("minimum value :- ", min(tup))
Output :-
Enter a tuple :-(1,2,3,4,5,6,7,8,9)
1
2
3
4
5
6
7
8
9
(1, 2, 3, 4, 5, 6, 7, 8, 9)
maximum value :- 9
minimum value :- 1
>>>
Enter a tuple :-(6,5,3,4,5,966,5,3,2,4,53,0)
6
5
3
4
5
966
5
3
2
4
53
0
(6, 5, 3, 4, 5, 966, 5, 3, 2, 4, 53, 0)
maximum value :- 966
minimum value :- 0
>>>
please post its output too.
ReplyDeleteOk : )
Deletethanks for these solutions :)
ReplyDeleteWelcome : )
Deletethank for the solution
ReplyDeleteWelcome : )
Deletety
ReplyDeletethnku
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )