FishHook
Ненормально вообще давать переменным ничего не значащие имена
Понятно. А счетчик по умолчанию i ? Логичнее было использовать это имя вместо n ?
FishHook
Ненормально вообще давать переменным ничего не значащие имена

Acamori
Есть какие-либо инструменте в питоне для этого ?
class Restaurant(): ''' Simple restaurant model. ''' def __init__(self , restaurant_name , cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restaurant(self): ''''Method that describe our restaurant''' print('Our restaurant name is '+self.restaurant_name.title()+'and it have '+self.cuisine_type+'.') def open(self): '''Method which notifies that the restaurant is open''' print(+self.restaurant_name+' is openned.') restaurant = Restaurant('mad_party' , 'juuuuuuuuuuude')
python/ch9/9-1.py
python/ch9/9-1.py”, line 15, in <module>def make_dict(city, country): """добавляем значения в словарь""" # dict1 = {'city':city, 'country':country,} dict1["city"] = city dict1["country"] = country new_data = dict(dict1.items() + dict0.items()) return new_dat dict1 = {} # словарь для временного хранения данных dict0 = {} # определяем словарь val_input_one = "" # вводим переменную для города val_input_two = "" # вводим переменную для страны while True: val_input_one = input("название города ") if val_input_one == "q": break val_input_two = input("название страны ") if val_input_two == "q": break dict0 = make_dict(val_input_one,val_input_two) print (dict0)
import sys print (sys.platform) print (2 ** 10) x = 'spam' print (x * 8)
UtservareturЛибо перейди в директорию где лежит файл и оттуда запускай,
Назвал его script1.py и мне его надо выполнить его в командной строке. Но когда я ввожу в самой строке python script1.py, мне выдает
python: can't open file ‘script.py’ : No such file or directory