+ 1

Help here !please...when I entered wrong number its ask input and then execute else statement .I want it earlier.

def calculate(): aman = input("Press 1 to Add. ") a= int(input("enter first number ")) b= int(input("enter sceond number ")) calculate() if aman=="1": print(a+b) else: print("DONT ENTER WRONG NUMBER please press 1") 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, 11:12 PM
aman singh
aman singh - avatar
5 Answers
+ 4
Hi, can you make the code public so we can try it?
31st Aug 2018, 9:36 AM
Kyeol Williams
Kyeol Williams - avatar
+ 3
There are several ways, if go to your code and look for an option in the menu to switch from private to public
31st Aug 2018, 7:32 PM
Kyeol Williams
Kyeol Williams - avatar
+ 1
That's bcz you haven't added any condition for taking inputs a and b. cut and paste your a= int(input(.......... & b= int(input(........ inside that if aman == "1": block. And didn't get why are you recursively calling calculate().
31st Aug 2018, 1:21 AM
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½ - avatar
0
bhai jab maine block likha toh error ho gaya... explain me deeply I am very beginner.....thanks...
31st Aug 2018, 3:15 AM
aman singh
aman singh - avatar
0
how's can I make it public ?
31st Aug 2018, 4:55 PM
aman singh
aman singh - avatar