Finishing up the Calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Finishing up the Calculator

while True: print ("Choose either","*","/","+","-","Q") x = input() if x == "Q": break print ("Closed") elif x in ("*","/","+","-"): a = float(input()) b = float(input()) if x == "*": print ("Results", a * b) if x == "+": print ("Results", a + b) if x == "-": print ("Results", a - b) if x == "/": if b == 0: print ('unable to compute') else: print ("Results" + a / b) Calculator is working but displays are too many did i miss something guy?

16th Nov 2018, 4:57 PM
umar
1 Answer
+ 5
your indentation is wrong after "b = input()" and you can't add int to str ( else: print("Results" + a/b) )
16th Nov 2018, 7:12 PM
Mert Yazıcı
Mert Yazıcı - avatar