Related to Python for Moon

Asked 2 years ago, Updated 2 years ago, 70 views

import math
import numpy as np
import matplotlib.pyplot as plt

def Nutzlast(time):

    t1 = time #[s]
    _________________________
    Required Values and Formulas
    _________________________

    nutzlast = ((m_b2 - (0.08/0.92)*m_dot_z*t_ges)/((0.08/0.92)+1))/1000 #[t]

    print("Gesamtmasseverhältnis r1 der ersten Stufe ist {:06.4f}".format(r1))
    print("Gesamtmasseverhältnis r2 der zweiten Stufe ist {:06.4f}".format(r2))
    print("Mittlere effektive Austrittsgeschwindigkeit der ersten Stufe ist {:06.4f} m/s".format(ce1))
    print("Nutzlast ist {:06.4f} t".format(nutzlast))

    return nutzlast


mylist = np.arange(50,200,0.01)
t_list = mylist
Nutzlast_list = []

for t1 in mylist:
    Nutzlast(t1) 
    Nutzlast_list.append(Nutzlast(t1))


total_list = np.zeros((15000,2))
total_list[:,0] = t_list
total_list[:,1] = Nutzlast_list


print(Nutzlast(131.7700))

Hello, I have a question because I can't figure it out even if I think about it. The challenge is to find the time when the maximum value comes out and then print other values that correspond to that time. I thought the last line print (Nutzalst (131.7700)) would return to the function and print only what corresponds to t1 = 131.7700, but it will continue to print from the beginning until the end. Like the picture below. I don't know why. Is there any solution?

python for

2022-09-20 17:54

1 Answers

Calls the Nutzlast function twice (with the same factor) within the for statement. Since there are print statements in the Nutzlast function, it seems that the same value is being taken twice.

If you want to see

, the last print print just before ((nutzlast.)) ("-" * * * * * * * 20) and to dip it in a line that can be divided.

Better yet, learn to run debug mode for the development tools you are using. https://www.youtube.com/watch?v=_mb_jlUgMqQ


2022-09-20 17:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.