Python 3 project 2 Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Python 3 project 2 Question

Hi all, I am new here and just started the Python 3 course. I have made some progress in the course but now I am stuck on project #2 called “simple calculator”. I keep inputting the correct answers (“9”, “33”) but it won’t accept it as the correct answer and let me move on. Can someone help me? What should the correct code look like for this project? Thank you!

22nd Nov 2020, 11:26 PM
Bluestar1212
Bluestar1212 - avatar
12 Answers
+ 3
You don't provide the input for these projects, you need to receive them and then output their sum. Don't forget to convert your input() to an int(). So, get first input convert to int and store in variable. Repeat for second input. Then add them together and output the sum. If you need further assistance provide your attempted code and myself or someone will help.
22nd Nov 2020, 11:36 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Bluestar1212 leave the input() parenthesis empty. This is where the 3 and 6 are coming from. When you pass a string to the function it is used as a prompt. Since there isn't any '\n' at the end, the next output follows directly after it on the same line.
24th Nov 2020, 8:36 PM
ChaoticDawg
ChaoticDawg - avatar
0
ChaoticDawg thank you so much for your answer. I am still having trouble with this problem. I am getting the correct answers “9” and “33” but the question itself won’t accept it. They are specifically Test Case #1 and Test Case #2. Any ideas how I can correctly solve this problem? thank you.
23rd Nov 2020, 12:40 AM
Bluestar1212
Bluestar1212 - avatar
0
You'll need to show your code so we can see what the issue is. Copy it to the playground, save it, and share a link to it.
23rd Nov 2020, 12:43 AM
ChaoticDawg
ChaoticDawg - avatar
0
# your code goes here num1 = int(input()) num2 = int(input()) print(num1 + num2) This was my solution please inbox me if you have any issues
24th Nov 2020, 5:44 PM
Noobmaster
Noobmaster - avatar
0
Hey ChaoticDawg here is what I have been working with. When I run it, I get the correct answers (“9” and “33”) but the question itself still won’t accept it and let me move on even though it says it is correct. Any ideas / solutions? thank you! x="3" y="6" z=int(x)+int(y) print(z) a="11" b="22" c=int(a)+int(b) print(c)
24th Nov 2020, 8:18 PM
Bluestar1212
Bluestar1212 - avatar
0
Noobmaster unfortunately your solution didn’t work. Here is what I wrote per your suggestion: num1 = int(input("3")) num2 = int(input("6")) print(num1 + num2) but the output was: 369. the question wouldn’t accept it as the correct answer. Any other suggestions? thank you!
24th Nov 2020, 8:22 PM
Bluestar1212
Bluestar1212 - avatar
0
ChaoticDawg !!! your solution worked!!! the question accepted: num1 = int(input()) num2 = int(input()) print(num1 + num2) Thank you SO much for your help! I am just beginning with Python and felt like I was making good progress until this. I was so frustrated the other day and felt like giving up because I was stuck on this problem. I can’t thank you enough for your assistance!! :)
24th Nov 2020, 9:34 PM
Bluestar1212
Bluestar1212 - avatar
0
@Noobmaster, that was awesome, i'd really confuse ,,,, but how the hack u can do that easily.. thank u btw
31st Dec 2020, 2:57 PM
quenie
quenie - avatar
0
quenie no problem
31st Dec 2020, 3:31 PM
Noobmaster
Noobmaster - avatar
0
x="3" y="6" z=int(x)+int(y) print(z) a="11" b="22" c=int(a)+int(b) print(c)
27th Apr 2021, 4:08 AM
Aryan kumar
Aryan kumar - avatar
0
x="3" y="6" z=int(x)+int(y) print(z) a="11" b="22" c=int(a)+int(b) print(c)
28th Apr 2021, 5:11 AM
Aryan kumar
Aryan kumar - avatar