-
-
Save codecademydev/1c88cffdac7ee02e6b644a9feddad5cb to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uncomment this when you reach the "Use the Force" section | |
train_mass = 22680 | |
train_acceleration = 10 | |
train_distance = 100 | |
bomb_mass = 1 | |
# Write your code below: | |
# Print Far to Cel | |
def f_to_c(f_temp): | |
c_temp = (f_temp - 32) * 5/9 | |
return c_temp | |
f100_in_celsius = f_to_c(100) | |
print(f100_in_celsius) | |
# Cel to Far | |
def c_to_f(c_temp): | |
f_temp = c_temp * 9/5 + 32 | |
return f_temp | |
c0_in_fahrenheit = c_to_f(0) | |
print(c0_in_fahrenheit) | |
# Getting the force from the train | |
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.") | |
# Getting the energy from a random bomb | |
def get_energy(mass, c = 3*10**8): | |
return mass * c**2 | |
bomb_energy = get_energy(bomb_mass,) | |
print("A 1kg bomb supplies", bomb_energy, "Joules") | |
# Getting the amount of work done from the train | |
def get_work(mass, acceleration, distance): | |
force = get_force(mass, acceleration) * distance | |
return force | |
train_work = get_work(train_mass, train_acceleration, train_distance) | |
print("The GE train does", train_work, "Joules of work over", train_distance , "meters.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
valid, helped me check my work <3