Python simple calculator says test is right but won’t let me finish the test.. says try again Simple calculator… X = 2 Print (x + 8) Is this correct? For output 10
5/22/2022 3:26:04 PM
JordanMcNamara11 Answers
New Answer"Write a program to take two integers as input and output their sum." In your code you are not taking any input.
Hi JordanMcNamara ! When you run your code, and get an error message, take that as a hint to start searching for the error. In the error message you got, Python respond that it don’t recognize the name ’Print’. Thats because the Python built-in functions name is ’print’. >>> X = 2 >>> Print (x + 8) Traceback (most recent call last): File "file0.py", line 2, in <module> Print (x + 8) NameError: name 'Print' is not defined
I have also noticed that you need to also use lowercase p in the print statement, because you are telling that there is a variable named Print, not telling to print that.
Thank you eveyone I honestly appreciate this community, im glad i asked the question.
Python is also case sensitive. So the variable “X” is different than the variable “x”
There is some sort of glitch cause sometimes it says im supposed to output 9. When it says try to output 10. Thanks for your response
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message