+ 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 :)

5th Apr 2018, 3:46 PM
GramatickĂ˝ Komunista
GramatickĂ˝ Komunista - avatar
3 Answers
+ 1
you can try something like this cInit = 0 c=input... if not c c = cInit
5th Apr 2018, 4:08 PM
Damyan Petkov
Damyan Petkov - avatar
+ 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)
5th Apr 2018, 9:38 PM
GramatickĂ˝ Komunista
GramatickĂ˝ Komunista - avatar
0
Thanks, gonna try. :)
5th Apr 2018, 4:10 PM
GramatickĂ˝ Komunista
GramatickĂ˝ Komunista - avatar