【发布时间】:2021-02-16 17:52:48
【问题描述】:
rent = int("300")
shopping = int("150")
clothes = int("200")
print("you have ", + cash, "dollars")
print("You have 3 options to spend your money")
print("$300 - Rent - 1")
print("$150 - Shopping - 2")
print("$200 - Clothes - 3")
choice = input("Enter a number between 1-3 to choose how you spend your money")
if choice == 1:
print("you now have", cash - rent, "dollars")
elif choice == 2:
print("you now have", cash - shopping, "dollars")
if/elif 部分不会打印其中包含的内容。
【问题讨论】:
-
那是因为
choice既不等于1也不等于2。 -
选择 = int(input())
-
int(input()) 一个不起作用
标签: python