+ 1

Clear this please.else statement print after the input statement. When someone press 2 instantly else statement run..please help

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("DONT ENTER WRONG NUMBER please press 1")

31st Aug 2018, 5:00 PM
aman singh
aman singh - avatar
12 ответов
+ 4
Try this one: aman = input('Press 1 to Add') if aman == '1': a = int(input('Enter first number:') b = int(input('Enter second number:') print(a+b) else: print('Please press 1')
31st Aug 2018, 5:08 PM
Jishu🎗💛
Jishu🎗💛 - avatar
+ 3
This should do it: def calcu(): aman = input('Press 1.Add/2.Subs') if aman == '1' or aman == '2': a = int(input('Enter first number') b = int(input('Enter second number') if aman == '1': print(a+b) elif aman == '2': print(a-b) else: print('Enter 1 or 2') calcu() calcu()
31st Aug 2018, 8:22 PM
Jishu🎗💛
Jishu🎗💛 - avatar
+ 3
I don't really like giving my whatsapp away, sorry. But we can always talk here and I will help you with all I can!
31st Aug 2018, 9:12 PM
Jishu🎗💛
Jishu🎗💛 - avatar
+ 3
I am from spain. You can check where a person is from in their profile and then skills. It shows the leaderboard position in their country
31st Aug 2018, 9:15 PM
Jishu🎗💛
Jishu🎗💛 - avatar
+ 2
You should copy and paste the link, which is in the code. We can talk via discord if you want and have one!
31st Aug 2018, 9:19 PM
Jishu🎗💛
Jishu🎗💛 - avatar
+ 1
saus u see my calculator program?
1st Sep 2018, 5:37 PM
aman singh
aman singh - avatar
0
thanks....but what if I add in subtraction statement.. def calcu(): aman=(input("Press 1.Add/2.subs")) if aman==("1"): a= int((input)("enter first number ")) b= int((input)("enter sceond num")) print(a+b) elif aman==("2"): a= int((input)("enter first number ")) b= int((input)("enter sceond num")) print(a-b) else: print ("DONT ENTER WRONG num") calcu() I don't want to add input statement again and again..so is there any way to shorten this
31st Aug 2018, 7:02 PM
aman singh
aman singh - avatar
0
thanks again saus... You are a very good explaner. u use whatsapp so we can chat if u don't mind it will really help to me to understand very fast
31st Aug 2018, 9:09 PM
aman singh
aman singh - avatar
0
thanks u so much . where u from?
31st Aug 2018, 9:13 PM
aman singh
aman singh - avatar
0
oh! thanks is there any way to talk to u I mean I don't know when u r online and I can't play your tic tac toe game ..how can I play it... thanks
31st Aug 2018, 9:18 PM
aman singh
aman singh - avatar
0
I don't have discord but I will install it...ok I'm gonna play your game...
31st Aug 2018, 9:21 PM
aman singh
aman singh - avatar
0
WOW! your game is too owesome..is there any way to make a button which we can touch it in tic tac toe game.... And please see my calculator program..in codes
31st Aug 2018, 9:30 PM
aman singh
aman singh - avatar