jupyter上的星号(python)
我在python上编写代码,但它在单元格上数字所在的位置显示了一个星号,我试着编写一个打印程序,看看它是否是代码,但仍然不起作用。请帮忙,这是密码jupyter上的星号(python),python,jupyter-notebook,Python,Jupyter Notebook,我在python上编写代码,但它在单元格上数字所在的位置显示了一个星号,我试着编写一个打印程序,看看它是否是代码,但仍然不起作用。请帮忙,这是密码 Items = "" Total = 0 def adding_report(report): while True: X = input("please input integer to add or Q to quit") if X.isdigit() == "True": X =
Items = ""
Total = 0
def adding_report(report):
while True:
X = input("please input integer to add or Q to quit")
if X.isdigit() == "True":
X = int(X)
Total = Total + X
if report == "A":
Items = Items + X
elif X == "Q":
print("Your result is")
if report == "A":
print("Items")
print(Items)
print("total")
print(Total)
break
else:
print("invalid input.")
adding_report("T")
你陷入了一个无限循环。 此外,您不能与字符串
“True”
进行比较,而只能与True
进行比较:
if X.isdigit() == True:
而不是:
if X.isdigit() == "True":
您还可以跳过与True
的比较
if X.isdigit():
你陷入了一个无限循环。 此外,您不能与字符串
“True”
进行比较,而只能与True
进行比较:
if X.isdigit() == True:
而不是:
if X.isdigit() == "True":
您还可以跳过与True
的比较
if X.isdigit():
错误是什么?你的问题是什么?错误是什么?你的问题是什么?