Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #P2PU
- #Exercises taken from the book http://www.py4inf.com/book_006.pdf
- #Lesson
- #http://p2pu.org/en/groups/python-programming-101/content/variables-expressionss-and-statements/
- ##########################################
- #Andres Kwan
- ##########################################
- #2.2
- x = raw_input("Enter you name: ")
- print 'Hola' ,x
- # Hola Andres
- ##########################################
- #2.3
- inp = raw_input('Enter Hours\n')
- hours = float(inp)
- inp = raw_input('Enter Rate?\n')
- rate = float(inp)
- pay = hours * rate
- print 'pay: ' + str(pay) + '\n'
- #pay: 96.25
- print "pay: %1.2f \n" % pay
- #pay: 96.25
- ##########################################
- #2.4
- width = 17
- height = 12.0
- #int
- print type(width/2)
- #<type 'int'>
- #float
- print type(width/2.0)
- #<type 'float'>
- #float
- print type(height/3)
- #<type 'float'>
- #int
- print type(1 + 2 * 5)
- #<type 'int'>
- ##########################################
- #2.5
- celcius =float(raw_input('Celsius temperature?\n'))
- fahrenheit = celcius * 9.0/5 + 32
- print str(celcius) + ' Celsius are equivalent to ' + str(fahrenheit) + ' Fahrenheit \n'
Advertisement
Add Comment
Please, Sign In to add comment