+2

Simple calculator-python /Module 02

May someone explain to me How can I solve the tests case ? Edit : I do know how to solve the code the problem is that when I solve the first test case and open the seconde test case I solve it too but the output is wrong for the first test case So ?

12/14/2020 4:46:06 PM

Mariam Zerouk

+7

# your code goes here a=int(input()) b=int(input()) print(a+b) Method2: # your code goes here a=int(input()) b=int(input()) c=None c= a+b print(c)

+6

Mrim Ze Take 2 input using input() function. Remember this function returns String so you need to convert in integer. After that add both number.

+5

+5

May it help print('Contents \n\t1: SUM \n\t2: DIFFERENCE \n\t3: MULTIPLY \n\t4: DIVIDE \n\t5: POWER \n\t6: [15/12, 12:27 PM] @#₹%&\$!?: chrome version [15/12, 12:27 PM] @#₹%&\$!?: ek bccha kashmir se h toh wha 2 g network hREMINDER') print('Enter your choice') x=int(input ()) print('\n Enter two numbers :') a=int(input()) b=int(input()) if x==1: print("The sum is :",a+b) elif x==2: print(" The difference is :", a-b) elif x==3: print (" The product is :",a*b) elif x==4: print(" The quotient is :", a/b) elif x==5: print("The Answer is :",a**b) elif x==6: print("The reminder is :",a//b) else: print("Chose the right option :") # Try this

+4

Mrim Ze , Try using int(input()). //Remember ,we use int because python considers all user input as string. Try this x=int(input()) y=int(input()) print(x+y). you failed in different test cases because the project tried different input values for x and y. use input()to allow this

+3

Sergey Angry_Student_ I Am Groot ! the problem is not in the code but in the project they ask me to solve the problem for first test case like this input : x = 6 y = 3 z = int (x) + int (y) print (z) output : 9 correct for the test case #1 now i have to writ my seconde code : input: print ( 11 + 22) output: 33 correct for test case #2✅ wrong fir test case #1 ❌ its impossible to output both of 9 and 33

+2

Angry_Student_ thank you so much it works

+1

Mrim Ze input () gives us as a String so we need to convert in int if you are taking integer value. a = input () b = input () res = int(a) + int(b) print(res)

+1

I Am Groot ! Thank you i get it

0

0

Ankit Nainwal Thank you

0

# your code goes here x=int(input()) y=int(input()) print(x+y)

0

Num1 = input(str("enter the first number: ")) Num2 = input(str("enter the second number: ")) Result = (int(Num1) + (int(Num2))) print (Result) WHY THIS DOESNT WORK

0

eman mama That is working but program is not accepting because you are passing value in input function which will print on console so remove that string from input function.

0

profile/25433607 The problem is not the code, the project they gave me to solve. test case 1 bill = int(input()) tip = float(125/5) print(tip) output 25.0 then test case 2 bill = int(input) tip = float (268/5) print = tip output 53.6 test case 1 #✅ test case 2#❌ How do I put both codes at the same time? Help me make both correct.