[英]Variable name gives Syntax error (Python)
我制作的一個簡單程序有問題。
num2 = 0
num1 = 1
print ("Enter a number one after another to sum them up, and when you're done type 0")
while num1 != 0:
num1 = float(raw_input ("Please enter a number:")
num2 += num1
if num1 == 0:
print ("The sum of the numbers is:" + str(num2))
出於某種原因,行num2 += num1
給了我一個語法錯誤num2
。
你錯過了一個)
,右括號,這里:
num1 = float(raw_input ("Please enter a number:")
應該
num1 = float(raw_input ("Please enter a number:"))
num = (int(input('pick a number to find if it is prime')
div = 2
while num !% div or div != num-1
f=num/div
if num % div :
print('no as ' ,num, 'is divisible by ',div)
div = 2
else:
div=div+1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.