How do I multiply user input numbers with numbers I type in?
I have
weight = input ('What is your weight')
print ('this is your weight on the moon')
print weight*.165
this does not work why?
There are a couple of problems. As noted by Outlaw Lemur, print is a function in Python 3. Also, you'll need to make the weight either a float or an int (it doesn't matter which) or else you'll get a TypeError.
weight = float(input ('What is your weight'))
In python 3, the print
statement has been replaced by the print()
function . You need:
weight = input ('What is your weight')
print ('this is your weight on the moon')
print (weight*.165)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.