Я пытаюсь зациклить вход за выбранное количество времени «введите, как ингредиенты вы хотите:« скажите, если пользователь вводит 5, тогда «ингредиенты» цикла будут выполняться 5 раз для них для ввода их ингредиентов. Извините, если это похоже на основной вопрос, но я совершенно новичок в этом. Спасибо за любые ответы :).Запуск цикла (x) раз
a=input("hello, welcome to the recipe calculator \nenter your recipe name, number of people you will serve and the list of ingredients \n1.retrive recipe \n2.make recipe \noption:")
if a=="2":
print("now enter the name of your recipe")
f=open('c:\\username_and_password.txt', 'w')
stuff = input("create name:")
nextstuff = (int(input("enter number of people:")))
nextstufff = (int(input("enter how many ingredients you want:")))
for (nextstufff) in range(0, 10): #I have put 0, 10 because the user probably wont put more than 10 ingredients. But there's probably a much better way?
print ("ingredient") + (nextstufff) #what am I doing wrong in this for loop
nextstuffff = (int(input("so how much of\n" + nextstufff + "would you like:")))
f.write(str(stuff + "\n") + str(nextstuff) + str(nextstufff))
f.close()
Просто голова, 'nextstuff',' nextstufff' и 'nextstuffff' не особенно легко различить ... – StephenTG