定义闪光距离函数,它采用参数时间间隔(秒)并用公式计算:
the distance(in kilometers) = time interval(in seconds) * 330 / 1000.
以公里为单位的闪电距离并返回。距离应四舍五入为整数。返回值的闪光距离函数必须已经四舍五入。
我有这样的程序,但有些地方非常错误,我需要帮助。我必须做什么和怎么做?
def flash_distance (number_ms):
flash_distance = (number_ms * 330/1000)
round return (flash_distance * 330/1000)
distance_ms = 330
distance = int (input ("How many seconds it took seeing the lightning flash hearing?"))
print ("lightning distance in kilometers:" + str (flash_distance (distance_ms)))