Reputation: 47
I'm playing around with Python3. I want weight
to be an int but I don't know what I'm doing wrong.
age = input("How old are you? ")
height = input("How tall are you? ")
#Since I want to play around, I just want to Turn KG to LBS
#Below is where I'm stuck
weight = int(round(input("How much do you weight? ")*2.2046))
print(f"so you are {age} old, {height} tall and {weight}LBS heavy")
Thanks in advance.
Upvotes: 0
Views: 194
Reputation: 2203
You need to cast your input(which is a string
) into int
/float
first, before you can do number operation (*
) with it.
i.e.
weight = round(int(input("How much do you weight? "))*2.2046)
Notice how int(input('...weight?'))
will be evaluated first, then the *2.2046
part, finally round()
.
Upvotes: 3