IN PYTHON Specification Your script should ask the user for a minimum Celsius te
ID: 3674194 • Letter: I
Question
IN PYTHON
Specification
Your script should ask the user for a minimum Celsius temperature and then a maximum Celsius temperate.
It should then print out a Celsius to Fahrenheit conversion table for this range of Celsius temperatures.
The table should have the same format as in homework 5.
The script must have two functions, print_fahrenheit and print_conversion_table.
print_fahrenheit must take as its parameter the Celsius temperature and print a line of the table with the Celsius temperature, a tab, and then the Fahrenheit temperature.
print_conversion_table must take two arguments, the minimum and maximum Celsius temperature in the table.
print_conversion_table must print the header for the table and call print_fahrenheit to print each line of the table.
Testing
Your output should look something like this
I have tried but haven't come with a solution.
Explanation / Answer
def print_fahrenheit(celcius):
print(str(celcius) + ' ' + str(int(((9 * celcius) / 5) + 32 + .5)))
def print_conversion_table(min_celcius, max_celcius):
print('Celsius Fahrenheit')
print('------------------')
for i in range(min_celcius, max_celcius + 1):
print_fahrenheit(i)
minCelcius = int(input('Please enter the starting temperature for the table: '))
maxCelcius = int(input('Please enter the ending temperature for the table: '))
print_conversion_table(minCelcius, maxCelcius)