存储距离的Python代码
“不对。运行代码时出错。检查同一行代码前面是否没有空格。' 为什么这不起作用 我想我可以这样做,存储距离的Python代码,python,Python,“不对。运行代码时出错。检查同一行代码前面是否没有空格。' 为什么这不起作用 我想我可以这样做,打印纳米距离=0.2998其他方法: # Write Python code that stores the distance # in meters that light travels in one # nanosecond in the variable, nanodistance. # These variables are defined for you: speed_of
打印纳米距离=0.2998
其他方法:
# Write Python code that stores the distance
# in meters that light travels in one
# nanosecond in the variable, nanodistance.
# These variables are defined for you:
speed_of_light = 299800000. # meters per second
nano_per_sec = 1000000000. # 1 billion
# After your code,running
# print nanodistance
# should output 0.2998
# Note that nanodistance must be a decimal number.
# ASSIGN nanodistance BELOW this line
------------------------------------------
speed_of_light/nano_per_sec = nanodistance
print nanodistance
打印纳米距离=光速/纳米秒也不起作用,但纳米距离=光速/纳米秒请确保指令中没有前导空格,除非它们位于函数定义内。这看起来像作业。。。
nanodistance = speed_of_light / nano_per_sec