#9-1 class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name=restaurant_name self.cuisine_type=cuisine_type def discribe(self): print(self.restaurant_name.title()+' is a '+self.cuisine_type.title()+' restaurant') def openrestaurant(self): print(self.restaurant_name+' is now openning') restaurant=Restaurant('Star','Chinese') restaurant.discribe() restaurant.openrestaurant() #9-2 a1=Restaurant('a1','west') a2=Restaurant('a2','india') a3=Restaurant('a3','Thai') a1.discribe() a1.openrestaurant() a2.discribe() a2.openrestaurant() a3.discribe() a3.openrestaurant() #9-3 class user(): def __init__(self,name, id , phone): self.name=name self.id=id self.phone=phone def discribe_user(self): print('user is '+self.name+' id is '+str(self.id)+' phone number is '+str(self.phone)) def greet_user(self): print('hello '+self.name) user1=user('jin',16337,10000) user2=user('king',12312,234234) user3=user('fun',123123,3232432324) user1.discribe_user() user2.discribe_user() user3.discribe_user() user2.greet_user() user1.discribe_user()
Star is a Chinese restaurant
Star is now openning
A1 is a West restaurant
a1 is now openning
A2 is a India restaurant
a2 is now openning
A3 is a Thai restaurant
a3 is now openning
user is jin id is 16337 phone number is 10000
user is king id is 12312 phone number is 234234
user is fun id is 123123 phone number is 3232432324
hello king
user is jin id is 16337 phone number is 10000