(т.е. macdonalds -> Macdonalds ; pho Hang -> Pho Hung)
мой ответ:
Код: Выделить всё
class Restaurant:
def __init__ (self, restaurant_name, cuisine_type):
self.name = restaurant_name
self.type = cuisine_type
def describe_restaurant(self):
print(f"This restaurants name is: '{self.name}' and serves {self.type}")
def restaurant_open(self):
print(f"'{self.name}' is currently open")
res1 = Restaurant('pho hung','vietnamese pho')
res1.describe_restaurant()
res2 = Restaurant('macdonalds','american fast')
res2.describe_restaurant()
res2.restaurant_open()
TLDR: как заставить метод класса печатать строку с заглавной буквы в качестве вывода
Подробнее здесь: https://stackoverflow.com/questions/791 ... -in-python