Jan-20-2017, 05:53 PM
(This post was last modified: Jan-20-2017, 05:53 PM by rattlerskin.)
Hello,
This is my first post and my first exposure to Python as a result of a college course I'm taking. My assignment asks to modify a program so that is computes and prints a table of celsius temperatures and the Fahrenheit equivalent every 10 degrees from 0C to 100C. The textbook is not very clear as to how I am supposed to work such a loop, and I've tried many different ways in the last hour but I can't quite figure out if I am defining my variables in the wrong spot or if I am not properly defining the loop. I keep getting a "SyntaxError: Missing parentheses in call to 'print'", so I hope I can get some direction here.
Thanks!
This program computes and prints a table
of Celsius temperatures and the Fahrenheit equivalent
every 10 degrees from 0C to 100C
Enter the number zero to begin 0
The temperature is 32.0 degrees Fahrenheit.
Process finished with exit code 0
I need it to create a table from 0C to 100C, so I don't understand how to get the loop to continue on and create my table.
This is my first post and my first exposure to Python as a result of a college course I'm taking. My assignment asks to modify a program so that is computes and prints a table of celsius temperatures and the Fahrenheit equivalent every 10 degrees from 0C to 100C. The textbook is not very clear as to how I am supposed to work such a loop, and I've tried many different ways in the last hour but I can't quite figure out if I am defining my variables in the wrong spot or if I am not properly defining the loop. I keep getting a "SyntaxError: Missing parentheses in call to 'print'", so I hope I can get some direction here.
Thanks!
def main(): print("This program computes and prints a table") print("of Celsius temperatures and the Fahrenheit equivalent") print("every 10 degrees from 0C to 100C") celsius = eval(input("Enter the number zero to begin ")) for i in range (0, 101, 10): fahrenheit = 9/5 * celsius + 32 print("The temperature is", fahrenheit, "degrees Fahrenheit.") main()I'm not getting an error per se, but rather this response:
This program computes and prints a table
of Celsius temperatures and the Fahrenheit equivalent
every 10 degrees from 0C to 100C
Enter the number zero to begin 0
The temperature is 32.0 degrees Fahrenheit.
Process finished with exit code 0
I need it to create a table from 0C to 100C, so I don't understand how to get the loop to continue on and create my table.