Advertisement
Guest User

Untitled

a guest
Jul 9th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. Exercise 2.2 Write a program that uses raw_input to prompt a user for their name and then
  2. welcomes them.
  3. a ='Enter your name:'
  4. b = raw_input(a)
  5. print "Hello" ,b
  6.  
  7. Exercise 2.3 Write a program to prompt the user for hours and rate per hour to compute gross
  8. pay.
  9. a='Enter Hours:'
  10. b=raw_input(a)
  11. c='Enter Rate:'
  12. d=raw_input(c)
  13. print "Pay", int(b)*float(d)
  14.  
  15. Exercise 2.4 Assume that we execute the following assignment statements:
  16. width = 17
  17. height = 12.0
  18. For each of the following expressions, write the value of the expression and the type (of the
  19. value of the expression).
  20. 1. width/2 =8 - int
  21. 2. width/2.0=8.5 - float
  22. 3. height/3=4.0 - float
  23. 4. 1 + 2 * 5=11 -int
  24.  
  25. Exercise 2.5 Write a program which prompts the user for a Celsius temperature, convert the
  26. temperature to Fahrenheit and print out the converted temperature.
  27.  
  28. a="Please enter the temperature value( C ): "
  29. b= raw_input(a)
  30. print "Converted value: ", float(b)*1.8+32
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement