+ 1

Please clear this....when someone press except 1 then print else statement...without showing input..THANKS.in ADVANCED.important

def calculate(): aman = input("Press 1 to add") a= int(input("enter first number")) b= int(input("enter sceond number")) if aman=="1": print(a+b) else: print("you put wrong number") again() def again(): calc_again = input("""do you try again please press Y for yes and N for no""") if calc_again.upper()== 'Y': calculate() elif calc_again.upper()=='N': print("se u later") else: again() calculate()

30th Aug 2018, 8:41 PM
aman singh
aman singh - avatar
6 Answers
+ 6
fixed I think def calculate(): aman = input("Press 1 to add") if aman=="1": a= int(input("enter first number")) b= int(input("enter sceond number")) print(a + b) else: print("you put wrong number") again()
31st Aug 2018, 5:55 AM
Mert Yazıcı
Mert Yazıcı - avatar
0
In SoloLearn, you have to give all inputs when you run your code.
30th Aug 2018, 9:03 PM
Théophile
Théophile - avatar
0
I don't understand........?
30th Aug 2018, 9:06 PM
aman singh
aman singh - avatar
0
So, when you run your code, all inputs must be given first : all arguments (Aman, a, b) separated by lines.
30th Aug 2018, 9:14 PM
Théophile
Théophile - avatar
0
what I want to know is when i pressed wrong input like a,add ,00 or something else. then it says u put a wrong number instead of showing input like(enter first no. enter second no. and then the program show me u put a wrong number .. I want instantly.....
30th Aug 2018, 9:21 PM
aman singh
aman singh - avatar
0
its says error
30th Aug 2018, 11:06 PM
aman singh
aman singh - avatar