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

2024-04-20 13:31:49 发布

您现在位置:Python中文网/ 问答频道 /正文

如何将用户输入的数字与我输入的数字相乘?你知道吗

我有

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

这不管用为什么?你知道吗


Tags: the用户inputyourison数字this
2条回答

有几个问题。正如不法分子Lemur所指出的,print是python3中的一个函数。此外,您还需要将权重设置为float或int(不管是哪个值),否则会出现TypeError。你知道吗

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

在python3中,^{} statement has been replaced by the ^{} function。您需要:

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

相关问题 更多 >