+ 2

Can someone help me? I can't find the problem. Plss🥺

nom1 = input("") operator = input("") nom2 = input("") if operator == "+": result= nom1+nom2 print(result) elif operator=="-": result=nom1-nom2 print(result) elif operator =="*": result=nom1*nom2 print(result) elif operator =="/": result=nom1/nom2 print (result) else: print("error")

22nd Jul 2023, 9:43 AM
LbC
LbC - avatar
4 Respostas
+ 7
please note that the input is always a string. if you want a num (int = integer) you have to convert the input. https://code.sololearn.com/c0pPk83UOfVo/?ref=app
22nd Jul 2023, 9:52 AM
Angela
Angela - avatar
+ 2
Thank u!!
22nd Jul 2023, 9:56 AM
LbC
LbC - avatar
+ 1
Try nom1 = int(input()) nom2 = int(input()) Or Result = int(nom1) + int(nom)2
22nd Jul 2023, 11:13 PM
Meiqdad Hassani
Meiqdad Hassani - avatar
+ 1
Sololearn does not support multiple separated inputs, so you must insert your multiple inputs in same input, separated by a newline Like this 12 + 12
23rd Jul 2023, 12:21 PM
Radi
Radi - avatar