0

Why this code doesn't work?

while True: print ("welcome\ntype add, subtract, divide or multiply") z = input(": ") if z == "add": print ("enter first number") x = float(input(": ")) print ("enter second number") y = float(input(": ")) print (x+y) elif z == subtract: print ("enter first number") x = float(input(": ")) print ("enter second number") y = float(input(": ")) print (x-y) elif z == divide: print ("enter first number") x = float(input(": ")) print ("enter second number") y = float(input(": ")) print (x/y) elif z == multiply: print ("enter first number") x = float(input(": ")) print ("enter second number") y = float(input(": ")) print (x*y) else: print ("invalid input")

10th Oct 2019, 7:41 AM
azizaqs
6 ответов
+ 1
Okay, thank you very much.
10th Oct 2019, 8:08 AM
azizaqs
0
Thank you. I wrote add 1 2 in different lines during input and it gave me 3.0. But at the end there was an Eof error for line 3. What is eof error?
10th Oct 2019, 7:54 AM
azizaqs
0
So the code is alright? Is it just sololearn limitations?
10th Oct 2019, 8:06 AM
azizaqs