【发布时间】:2021-09-14 16:55:32
【问题描述】:
我在 Spyder 中编写了一个 python 脚本,并试图在我的机器上运行它,但 Windows 上的 Python 3.7 将它关闭得很早。
我的代码是:
print('Campus Pizza Ordering Program\n')
crust = input('What crust? Regular or Wheat? ')
num_toppings = int(input('How many toppings (please enter a whole number)? '))
price = format((7 + num_toppings * 0.75),".2f") #looked up how to round to 2 decimals
print('\nYou have a '+crust+' pizza with '+str(num_toppings)+' toppings. ' +
'The final price of the pizza is $'+str(price)+".")
程序在最后的打印语句执行之前关闭。为什么?
【问题讨论】:
-
你是如何运行程序的?点击它?使用 cmd 提示符?