• Log in or sign up for an account here: https://www.sythe.org/login

Need help writing a script [Python]

Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
What are the formulas for each thing you need to find?

p = mv, don't know about energy though

It's super basic. Take in input of m and v, do formula. Take in input for things needed for kinetic energy (if necessary), do formula.

I don't know Python and I don't care to learn it for the sake of this thread, but what you should look up is how to get input and print into a console window. Then just do the math, i.e. p = m*v; and your assignment will be done.
 
I am taking a beginner level programming class. I have no idea what I am doing. I have a worksheet with some problems that I need help learning how to do. Maybe somebody here can help me with one to help me get the ball rolling. Thank you in advance!

Write a program that calulates an objects momentum. The program should expect an object's mass and velocity as inputs and prints its momentum. Then modify the program to calculate the Kinetic enery of the object.

With python 3.3.2

mass = eval(input("Enter mass: "))
velocity = eval(input("Enter velocity: "))

print("Momentum:", mass*velocity)
 
With python 3.3.2

mass = eval(input("Enter mass: "))
velocity = eval(input("Enter velocity: "))

print("Momentum:", mass*velocity)

Don't teach bad things. It should be at least float instead:

mass = float(input("Enter mass: "))
velocity = float(input("Enter velocity: "))
print("Momentum:", mass*velocity)
 
duelarena.gg
Back
Top