Python @ DjangoSpin

PyPro #23 Conversion Table: Celsius to Fahrenheit Temperatures

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

Conversion Table: Celsius to Fahrenheit Temperatures in Python - Write a Python script to output a conversion table for Celsius to Fahrenheit temperatures. Ask the user to input lower bound and upper bound of Celsius temperatures. Using range() and a for loop, output the corresponding Fahrenheit readings. Formula: f = 32 + ( (9/5) * c)

Conversion Table: Celsius to Fahrenheit Temperatures in Python

# Celsius to Fahrenheit conversion table
# Ask the user to input a range of Celsius temperatures.
# Within the specified range, output the corresponding Fahrenheit temperatures.

lowerBound = int(input("Please enter the lower bound of Celsius temperature: "))
upperBound = int(input("Please enter the upper bound of Celsius temperature: "))

for celsiusTemp in range(lowerBound, upperBound + 1):
    correspondingFahrenheitTemp = 32 + ( (9/5) * celsiusTemp )
    print(float(celsiusTemp), "deg C =", float(correspondingFahrenheitTemp), "deg F")
Try it here.

See also:


Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon