第九章作业

9-1

class 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-2

class 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-3

class 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));


猜你喜欢

转载自blog.csdn.net/qq_36401790/article/details/79860620