Answer to Question #239725 in Python for Addie

Question #239725

Write a program that allows a secretary to store the names, total student population and

programmes available of all universities in Zimbabwe and sorts them in ascending order

according to student pop. The program should allow a searching facility by name and

updating of population. Make use of functions and data structures
1
Expert's answer
2021-09-21T11:02:28-0400
class University():
    def __init__(self, names, population,programmes ):
        self.names = names
        self.population  = population
        self.programmes  = programmes  


    def display(self):
        print("Students: ", self.names)
        print("Population: ", self.population)
        print("Programmes: ", self.programmes)
        print()




universities=[]
universities.append(University("Tim,Peter,Mary...",1500,"Math,IT"))
universities.append(University("Mike,Julia...",1200,"Biologi,IT"))
universities.append(University("Den,Ann...",1800,"Physics,IT"))
universities.sort(key=lambda x: x.population)
for u in universities:
    u.display()
    

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