Jun 28, 2020 05:06 PM
(This post was last modified: Jun 28, 2020 06:47 PM by LSD.)
My first free form project on Codeacademy.. a simple calculator.
The output for the defined variables is:
But you can input any numbers and it will output the proper calculations using the correct formula :)
Code
train_mass = 22680
train_acceleration = 10
train_distance = 100
bomb_mass = 1
#
#
#
def get_force(mass, acceleration):
return mass*acceleration
train_force = get_force(train_mass, train_acceleration)
print("The GE train supplies " + str(train_force) + " Newtons of Force.")
def get_energy(mass, c=3*10**8):
return mass*c*c
bomb_energy = get_energy(bomb_mass)
print("A 1kg bomb supplies " + str(bomb_energy) + " Joules.")
def get_work(mass, acceleration, distance):
return get_force(mass,acceleration)*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.")The output for the defined variables is:
Quote:The GE train supplies 226800 Newtons of Force.
A 1kg bomb supplies 90000000000000000 Joules.
The GE train does 22680000 Joules of work over 100 meters.
But you can input any numbers and it will output the proper calculations using the correct formula :)
I post all my trades and alpha on Twitter. @SlayerXBT

