Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # Exercise 2.5
- # Author: Landon Mayo
- # Title: Celsius to Fahrenheit Converter
- '''
- Exercise 2.5 Write a program which prompts the user for a Celsius temperature, convert the
- temperature to Fahrenheit and print out the converted temperature.
- '''
- #****************************************************
- # The conversion formulas between F and C are:
- #
- # C = (F - 32) * 5/9
- #
- # F = C * 9/5 + 32
- #****************************************************
- # getC is the temperature in Celsius (input from user)
- # putF converts the getC to float then performs the conversion
- # finally we print out the results
- def convertC():
- getC = raw_input('Enter Celsius Temperature: ')
- putF = float(getC) * 9/5 + 32
- print float(getC), 'Celsius =' ,float(putF), 'Fahrenheit'
- convertC()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement