Iโm very new here. This is my first post.
Here is the code of my try at the 3rd Lesson in Python: Functions.
Getting Ready for Physics Class.
I followed the instructions and it seems working, so I might have some code mistakes. Trying to grasp the concept of it
</
train_mass = 22680
train_acceleration = 10
train_distance = 100
bomb_mass = 1
#1
def f_to_c(f_temp):
c_temp = (f_temp - 32) * 5/9
return c_temp
#2
f100_in_celsius = f_to_c(100)
print(โ100 Degree Temperature Fahrenheit is in Celsius:โ, f100_in_celsius, โCโ)
#3
def c_to_f(c_temp):
f_temp = c_temp * (9/5) + 32
return f_temp
#4
c0_in_fahrenheit = c_to_f(0)
print(โZero Tempretature Celsius is in Fahrenheit:โ, c0_in_fahrenheit, โFโ)
#5
def get_force(mass, acceleration):
force= mass * acceleration
return force
#6
print(get_force(train_mass, train_acceleration))
train_force = get_force(train_mass, train_acceleration)
print(train_force)
#7
print(โThe GE train supplies " + str(train_force) + " Newtons of force.โ)
#8
def get_energy(mass, c):
c = 3108
energy = mass * c2
return energy
#9
bomb_energy = get_energy(bomb_mass, c= 310**8)
print(bomb_energy)
#10
print(โA 1kg bomb supplies " + str(bomb_energy) + " Joules.โ)
#11
def get_work(mass, acceleration, distance):
work = get_force(mass, acceleration) * distance
return work
#12
train_work = get_work(train_mass, train_acceleration, train_distance)
print(train_work)
print(โThe GE train does " + str(train_work) + " Joules of work over " + str(train_distance) + " meters.โ)
Let me know if there are any mistakes.
Cheers,