如何使我的函数每秒打印一次结果?

时间:2019-05-17 06:05:43

标签: function printing defined

我希望它每秒打印一次速度。

#I don't see why it doesn't work
import math
a = input("Please enter the acceleration of the rocket: ") #a is input
G = input("Please enter earth's gravity as in m/s^2: ") #g is input
m = 130000
me = 5.972*(10**24)
r = 6371000
ve = math.sqrt((2*(float(G)*me))/r)

#I think I might be doing something wrong with the function
def lol():
    vi=0
    for t in range(0, 1000000000):
        v = float(a)*t
        vi = vi + v
    for v in range(0, 100000000):
        vf = vi + v
        print(vf)
        if vf == ve:
            break

我无法每秒打印一次。我无法在此代码中添加任何内容。

0 个答案:

没有答案