Skip to content

Instantly share code, notes, and snippets.

@willium
Forked from anonymous/gist:4950095
Last active December 13, 2015 17:48
Show Gist options
  • Save willium/4950138 to your computer and use it in GitHub Desktop.
Save willium/4950138 to your computer and use it in GitHub Desktop.
print ("This program will find Mass(kg), Radius(m) or Time(s) via Kepler's law's")
print ("Enter x for the unknown value")
m = (input("Mass: "))
r = (input("Radius: "))
t = (input("Time: "))
x = ("unknown")
if m == x:
m = ((4*3.14*r**3)/(.0000000000667*t**2))
print ("m=")
elif r == x:
r = ((t**2*.0000000000667*m)/(4*3.14*r**2))**(1/3)
print ("r=")
elif t == x:
t = ((4*3.14**2*r**3)/(.0000000000667*m))**(.5)
print ("t=")
print ("This program will find Mass(kg), Radius(m) or Time(s) via Kepler's law's")
print ("Enter x for the unknown value")
m = raw_input("Mass: ")
r = raw_input("Radius: ")
t = raw_input("Time: ")
x = "x"
if m == x:
m = ((4*3.14*float(r)**3)/(.0000000000667*float(t)**2))
print "Mass: ", m
elif r == x:
r = ((float(t)**2*.0000000000667*float(m))/(4*3.14**2))**(1/3)
print "Radius: ", r
elif t == x:
t = ((4*3.14**2*float(r)**3)/(.0000000000667*float(m)))**(.5)
print "Time: ", t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment