如何将用户输入数字与我输入的数字相乘?
我有
weight = input ('What is your weight')
print ('this is your weight on the moon')
print weight*.165
这不起作用?
答案 0 :(得分:1)
有几个问题。正如Outlaw Lemur所指出的那样,print是Python 3中的一个函数。此外,你需要将权重设置为浮点数或整数(它并不重要),否则你将获得一个TypeError。
weight = float(input ('What is your weight'))
答案 1 :(得分:0)
在python 3中,print
statement has been replaced by the print()
function。你需要:
weight = input ('What is your weight')
print ('this is your weight on the moon')
print (weight*.165)