Python 如何将输入的数字与输入的数字相乘

Python 如何将输入的数字与输入的数字相乘,python,python-3.x,Python,Python 3.x,如何将用户输入的数字与我输入的数字相乘 我有 weight = input ('What is your weight') print ('this is your weight on the moon') print weight*.165 为什么这不起作用?在Python3中。你需要: weight = input ('What is your weight') print ('this is your weight on the moon') print (weight*.165) 有

如何将用户输入的数字与我输入的数字相乘

我有

weight = input ('What is your weight')
print ('this is your weight on the moon')
print weight*.165
为什么这不起作用?

在Python3中。你需要:

weight = input ('What is your weight')
print ('this is your weight on the moon')
print (weight*.165)

有几个问题。正如Outlaw Lemur所指出的,print是Python 3中的一个函数。此外,您需要将权重设置为float或int(哪一个都不重要),否则您将得到一个TypeError

weight = float(input ('What is your weight'))