+ 1
Unused inputs problem..
Hi If i have code like this a=input("") b=input("") c=input("") print(int(a) * int(b) * int(c)) Ok, but if i want use only 2 of 3 inputs and that third leave blank, it will show EOF error. How to make some of these inputs optional? Thanks in advance :)
3 odpowiedzi
+ 1
you can try something like this
cInit = 0
c=input...
if not c
c = cInit
+ 1
Ok i have it
empty=("")
inputs = []
a=input("")
b=input("")
c=input("")
d=input("")
e=input("")
f=input("")
if not a==empty:
inputs.append(a)
if not b==empty:
inputs.append(b)
if not c==empty:
inputs.append(c)
if not d==empty:
inputs.append(d)
if not e==empty:
inputs.append(e)
if not f==empty:
inputs.append(f)
print(inputs)
range=(len(inputs))
print(range)
0
Thanks, gonna try. :)