Answer to Question #281846 in Python for siddharth

Question #281846

A tuple have details about a hospital. The details are ward number, number of adults and number of children in that ward. There are n wards in the hospital. Display the number of adults in the ward number specified by the user (doctor). Display the ward that has maximum children


1
Expert's answer
2021-12-22T01:10:41-0500
#Assuming there are 3 wards in the hospital, the tuples below contain their information
list1 = [('ward1', 45, 20), ('ward2', 35, 30), ('ward3', 3, 30)]
list2 = []
for i in list1:
    print(i[1])
    list2.append(i[2])
print(max(list2))


45
35
3
30

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS