Reputation: 197
I write this code:
while(1):
a,b,c=input().split(" ")
a=int(a)
b=int(b)
c=int(c)
if(a==0):
break
else:
d=a*b
c=(d*100)/c
f=c**(1/2.0)
print(int(f))
but this error occured:
Traceback (most recent call last): File "Main.py", line 2, in
a,b,c=input().split(" ")
ValueError: need more than 1 value to unpack
Command exited with non-zero status (1)
please anyone tell me why this error occured and I can I get rid from this error.
Upvotes: 1
Views: 53
Reputation: 2390
your error is explained in the error message:
need more than 1 value to unpack
this means that werever your input function is returning, it does not have (at least) 2 spaces/tabs.
You expect to unpack 3 variables: a,b,c
so if there's no split(" ")
, you can't get 3 values back...
This works...
def input():
return "one two three"
a,b,c=input().split(" ")
Upvotes: 1