+ 4

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 ?

14th Dec 2020, 4:46 PM
Mariam Zerouk
Mariam Zerouk  - avatar
16 odpowiedzi
+ 12
# 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)
22nd Apr 2021, 2:17 PM
Prateek Gupta
Prateek Gupta - avatar
+ 5
Post your attempt so can we can help you
14th Dec 2020, 4:53 PM
Angry Student(Docvad)
Angry Student(Docvad) - avatar
+ 5
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.
14th Dec 2020, 4:56 PM
A͢J
A͢J - avatar
+ 5
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
14th Dec 2020, 6:29 PM
Angry Student(Docvad)
Angry Student(Docvad) - avatar
+ 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
16th Dec 2020, 3:06 AM
Ankit Nainwal
Ankit Nainwal - avatar
+ 4
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
14th Dec 2020, 6:22 PM
Mariam Zerouk
Mariam Zerouk  - avatar
+ 2
Angry_Student_ thank you so much it works
14th Dec 2020, 6:36 PM
Mariam Zerouk
Mariam Zerouk  - avatar
+ 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)
14th Dec 2020, 6:49 PM
A͢J
A͢J - avatar
+ 1
I Am Groot ! Thank you i get it
15th Dec 2020, 1:28 PM
Mariam Zerouk
Mariam Zerouk  - avatar
+ 1
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.
3rd May 2022, 9:40 AM
Kgotso Malefetse
+ 1
num1 = int(input()) num2 = int(input()) print(num1 + num2) !try this one!
30th Oct 2022, 5:02 AM
Shyra Galang
Shyra Galang - avatar
0
where is your code? and link
14th Dec 2020, 5:53 PM
Sergey
Sergey - avatar
0
Ankit Nainwal Thank you
16th Dec 2020, 2:12 PM
Mariam Zerouk
Mariam Zerouk  - avatar
0
# your code goes here x=int(input()) y=int(input()) print(x+y)
25th Aug 2021, 6:32 PM
Dijwar Ebdo
Dijwar Ebdo - avatar
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
16th Sep 2021, 6:52 PM
eman mama
eman mama - avatar
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.
16th Sep 2021, 7:42 PM
A͢J
A͢J - avatar