From d646003311c35499878bbb135ff4e710d1178d45 Mon Sep 17 00:00:00 2001 From: aay29-cell <63368467+aay29-cell@users.noreply.github.com> Date: Wed, 6 May 2020 13:56:06 -0500 Subject: [PATCH] Update docking.py Corrects user input --- docking.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/docking.py b/docking.py index 25b1a68..c5976f4 100644 --- a/docking.py +++ b/docking.py @@ -21,9 +21,24 @@ def accel_grav(d): # Parameters r_init = 99*(10**6) # m distance away from planet during landing/docking stage ### Will have to change v0 = -7*10**5 # initial velocity (m/s) ### Will have to change -m_mars = float(input("What it the mass of Mars?\n ____ x 10^23> ")) * 10**23 #6.39*(10**23) = mass of Mars (kg) -r = float(input("What is the radius of Mars?\n____x 10^6> "))*10**6 #3.3895*(10**6) = radius of Mars (m) -G = float(input("What is the gravitational constant G?\n ____x 10^-11> "))*10**-11 #6.67408*(10**-11)= gravitational constant +input1 = float(input("What it the mass of Mars?\n ____ x 10^23> ")) #6.39*(10**23) = mass of Mars (kg) +while input1!=6.39: + input1=float(input("Try again! What it the mass of Mars?\n ____ x 10^23> ")) +if input1==6.39: + print('Correct!') + m_mars=input1*(10**23) +input2 = float(input("What is the radius of Mars?\n____x 10^6> ")) #3.3895*(10**6) = radius of Mars (m) +while input2!=3.3895: + input2=float(input("Try again! What is the radius of Mars?\n____x 10^6> ")) +if input2==3.3895: + print('Correct!') + r=input2*(10**6) +input3 = float(input("What is the gravitational constant G?\n ____x 10^-11> ")) #6.67408*(10**-11)= gravitational constant +while input3!=6.67408: + input3=float(input("Try again! What is the gravitational constant G?\n ____x 10^-11> ")) +if input3==6.67408: + print('Correct!') + G=input3*(10**-11) F_thrust = 2*10**5 # kg*m/s^2 Reverse thrust of rocket ### Will Have to change constant v_ex = -4*10**(3) # m/s velocity of ejecting fuel ### Will have to change constant mass_fuel = MASS_FUEL