Write a Python program to show the temperatures starting at zero degrees Celsius, up to 100 degrees Celsius, in steps of 2 degrees, with the corresponding Fahreneit temperature shown in the next column. Temperatures should be shown as floating point numbers to two decimal places. Use a for loop for displaying each line of the table and the following formula for the temperature conversion:
Example Program run:
C F
0.00 32.00
2.00 35.60
4.00 39.20
6.00 42.80
100.00 212.00
_____________________________________________________
I have written the program and it works, but the problem i have is, my professor only wants the even number and its corresponding farenheit values to be shows, how do i do that?
This is the code I have typed in for this assignment and it works, just need to know to display the range of even numbers and its corresponding Fahrenheit values only, my code:
while 1:
print ("C" + '\t' +"F")
celsius = 0
for celsius in range(0, 101):
fahrenheit = 1.8 * celsius + 32
print ('%0.2f %0.2f' % (celsius,fahrenheit))
answer = input("\nWould you like to run this program again? y/n\n")
if answer == 'N' or answer == 'n':
break
print ()
print ()
print ("Thank you for using this program.")
print ("Goodbye...")
Thanks in advance.
Tony
Moderator's note:
Please use code tags with your Python code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help.
[code=python]
your Python code here
[/code]