Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. train_mass = 22680
  2. train_acceleration = 10
  3. train_distance = 100
  4.  
  5. bomb_mass = 10
  6.  
  7.  
  8. def get_force (mass, acceleration):
  9. return mass * acceleration
  10.  
  11. train_force = get_force (train_mass, train_acceleration)
  12. print ("The GE train supplies " + str(train_force) + " Newtons of force.")
  13.  
  14.  
  15. print ("")
  16.  
  17.  
  18. def get_energy (mass, c=3*10**8):
  19. return mass * c ** 2
  20.  
  21. bomb_energy = get_energy (bomb_mass)
  22. print ("A " + str(bomb_mass) + "kg bomb supplies " + str(bomb_energy) + " Joules.")
  23.  
  24. print ("")
  25.  
  26. def get_work(mass, acceleration, distance):
  27. return mass * acceleration * distance
  28.  
  29. train_work = get_work(train_mass, train_acceleration, train_distance)
  30. print ("The GE train does " + str(train_work) + " Joules of work over " + str(train_distance) + " meters.")
  31.  
  32. print ("")
  33. print ("--------------------")
  34. print ("")
  35.  
  36. #-----------------------------------------------#
  37.  
  38. print ("Fahrenheit to celsius conversion:")
  39. def f_to_c(f_temp):
  40. c_temp = (f_temp - 32) * 5/9
  41. return c_temp
  42.  
  43. f_var = 1000
  44.  
  45. f100_in_celsius = f_to_c(f_var)
  46.  
  47. print (str(f_var) + " degrees fahrenheit will convert to " + str(f100_in_celsius) + " degrees celsius.")
  48.  
  49.  
  50. #Titles and spacer.
  51. print ("")
  52. print ("Celsius to fahrenheit conversion:")
  53.  
  54. def c_to_f(c_temp):
  55. f_temp = c_temp * (9/5) + 32
  56. return f_temp
  57.  
  58. #Edit this value below ONLY. Everything else will fall in line.
  59. c_var = 38
  60.  
  61. c0_in_fahrenheit = c_to_f(c_var)
  62.  
  63. print (str(c_var) + " degrees celsius will convert to " + str(c0_in_fahrenheit) + " degrees fahrenheit.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement