Jun-29-2020, 07:50 PM
Python3
New coder
Prompt:
Write a program which prompts the user for a Celsius temperature, convert the temperature to Fahrenheit, and print out the converted temperature.
Question:
When I attempted to solve the following problem in the interpreter, it results in the following:
ctemp = input('Enter Celsius Temperature') \
... ftemp = float(ctemp) * (9 / 5) + 32 \
File "<stdin>", line 2
ftemp = float(ctemp) * (9 / 5) + 32 \
^
SyntaxError: invalid syntax
However, when I enter the same code in the Atom editor, no error occurs and the program runs with the correct answer.
My understanding is that aside from the pro's vs con's between using an editor vs. the interpreter, the Python rules (including syntax) are the same between an editor such as Atom and the interpreter.
Can you please examine my code to explain what I've missed?
Thank you everyone in advance for your help.
New coder
Prompt:
Write a program which prompts the user for a Celsius temperature, convert the temperature to Fahrenheit, and print out the converted temperature.
Question:
When I attempted to solve the following problem in the interpreter, it results in the following:
ctemp = input('Enter Celsius Temperature') \
... ftemp = float(ctemp) * (9 / 5) + 32 \
File "<stdin>", line 2
ftemp = float(ctemp) * (9 / 5) + 32 \
^
SyntaxError: invalid syntax
However, when I enter the same code in the Atom editor, no error occurs and the program runs with the correct answer.
My understanding is that aside from the pro's vs con's between using an editor vs. the interpreter, the Python rules (including syntax) are the same between an editor such as Atom and the interpreter.
Can you please examine my code to explain what I've missed?
Thank you everyone in advance for your help.