您的位置:首页 > 其它

第九章作业

2018-04-09 08:27 113 查看
9-1class Restaurant:
def __init__(self,name,_type):
self.restaurant_name = name;
self.cuisine_type = _type;
def describe_restaurant(self):
print('the name of the restaurant is{0}\n and the cuisine_type is {1}'.format(self.restaurant_name,self.cuisine_type));
def open_restaurant(self):
print('the restaurant is operating\n');

9-2class Restaurant:
def __init__(self,name,_type):
self.restaurant_name = name;
self.cuisine_type = _type;
def describe_restaurant(self):
print('the name of the restaurant is{0}\n and the cuisine_type is {1}'.format(self.restaurant_name,self.cuisine_type));
def open_restaurant(self):
print('the restaurant is operating\n');
r1 = Restaurant('R1','T1');
r2 = Restaurant('R2','T2');
r3 = Restaurant('R3','T3');
r1.describe_restaurant();
r2.describe_restaurant();
r3.describe_restaurant();
9-3class Urser :
def __int__(self,first_name,last_name):
self.first_name = first_name;
self.last_name = last_name;
def describe(self):
print("first_name :{0}\n last_name :{1}\n"format(self.first_name,self.last_name));
def greet_user(self):
print('hello, {}{}\n'.format(self.first_name,self.last_name));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: