Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 14, 2020 20:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save codecademydev/a9edc30f29b32630fc2c5fc461db8b4f to your computer and use it in GitHub Desktop.
Codecademy export
train_mass = 22680
train_acceleration = 10
train_distance = 100
bomb_mass = 1
def f_to_c (f_temp):
return (f_temp - 32) * 5/9
f100_in_celsius = f_to_c (100)
def c_to_f (c_temp):
return (c_temp * 9/5) + 32
c0_in_fahrenheit = c_to_f (0)
def get_force (mass, acceleration):
return (mass * acceleration)
train_force = get_force (train_mass, train_acceleration)
print (train_force)
print ("The GE train supplies " + str (train_force) + " Newtons of force.")
def get_energy (mass, c=3*10**8):
return (mass * c**2)
bomb_energy = get_energy (bomb_mass)
print ("A 1kg bomb " + str (bomb_energy) + " Joules. ")
def get_work (mass, acceleration, distance):
return force = (get_force * distance)
train_work = get_work (train_mass, train_acceleration,train_distance)
print("The GE train does " + str (train_work) + " Joules of work over " + str (train_distance) + " meters.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment