-2
# 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
'错误。运行代码时出错。检查你在同一行上的代码前面没有空格。'存储距离的Python代码
为什么这不起作用?
我想我可以做到这一点,print nanodistance = 0.2998
打印nanodistance = speed_of_light/nano_per_sec不工作,要么但 nanodistance = speed_of_light/nano_per_sec –
确保有在你的指令中没有前导空格,除非它们在函数定义中。 – Barranka
这看起来像作业... – wflynny