這是我的代碼,它是在Python版本2.7.13 writen:有人可以幫我找出這個錯誤
import random
num=random.sample(range(1,9),4)
print(num)
thing=1
while thing==1:
while thing==1:
Usernum=str(input("Input a number of four DIFFRENT digits all of which are between 1 and 9 or exit"))
if Usernum = "exit":
print("Goodbye")
break
else:
pass
if len(set(Usernum)) == 4:
pass
else:
print("You enterd a number that wasn't 4 digits, please try again!")
thing==1
pass
if Usernum.isdigit:
pass
else:
print("you entered something that isnt a number, please try again!")
pass
num1,num2,num3,num4 = Usernum.split()
if num1 in (num2,num3,nub4) or num2 in (num3,num4) or num3==num4:
print("you ented a number with duplicate digits, Please try again!")
else:
break
else:
pass
之前我收到這是我從未見過的錯誤。它說:
"ValueError: need more than 1 value to unpack"
這裏'如果Usernum =「退出」:' – e4c5
你的代碼有*許多*錯誤。 –