Want to add the text kg’s after accepting weight input

Question:

I’m new to Python and programming altogether. As I’m going through my first few online lessons, I’m trying to add text to the users weight i.e. 70kg’s

My code that works is as follows:

weight_lbs = input(“Please enter your weight in pounds? “)

weight_kg = int(weight_lbs) * 0.45

print(weight_kg)

Nb: the above code works but does not display the text “kg’s” after the number.

I’ve tried:
print(weight_kg) + “kg’s”
or
print(weight_kg + “kg’s”)
or
print(weight_kg), “kg’s”

Unfortunately I keep getting error, unsupported operand type(s) for +: ‘NoneType’ and ‘Str’

Thanks in advance

Mark

Asked By: Van Wilder

||

Answers:

print(f"{weight_kg}kg's")

or simply

print(str(weight_kg)+"kg's")
Answered By: biplob biswas
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.