Advertisement
jeffrey25

Python 101:Variables, expressions, and statements

Sep 28th, 2011
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #2.2
  2. import sys
  3.  
  4. name = input ("Enter your name : ")
  5. print ("Hello", name)
  6.  
  7.  
  8.  
  9. #2.3
  10. import sys
  11.  
  12. hours = input("Enter Hours : ")
  13. float_hours = float(hours)
  14.  
  15. rate = input("Enter Rate : ")
  16. float_rate = float(rate)
  17.  
  18. pay = float_hours * float_rate
  19.  
  20. print ("Pay" , pay)
  21.  
  22.  
  23. #2.4
  24. import sys
  25.  
  26. width = 17
  27. height = 12.0
  28.  
  29. print ("Width // 2 = ", width//2)
  30. print ("Type is ", type(width//2))
  31.  
  32. print ("Width / 2.0 = ", width/2.0)
  33. print ("Type is ", type(width/2.0))
  34.  
  35. print ("Height / 3 = ", height/3)
  36. print ("Type is ", type(height/3))
  37.  
  38. print ("1 + 2 * 5 = ", 1+2*5)
  39. print ("Type is ", type(1+2*5))
  40.  
  41.  
  42. #2.5
  43. import sys
  44.  
  45. celcius = input("Enter temp in Celcius : ")
  46. f_celcius = float(celcius)
  47.  
  48. fahrenheit = (f_celcius * 1.8) + 32
  49. f_fahrenheit = float(fahrenheit)
  50.  
  51. print ("Temperature in Fahrenheit is : ", f_fahrenheit)
  52.  
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement