Hi Folks,
Really excited with my Python journey. Please check the attached photos? I did everything similar to Mosh! But giving error every time! What did I do wrong here?
Hi Folks,
Really excited with my Python journey. Please check the attached photos? I did everything similar to Mosh! But giving error every time! What did I do wrong here?
Well, you did some minoe mistakes here.
replace this code line -
print(f"Your weight is {converted} kilos) with below line
print(f"Your weight is {converted} kilos")
Now replace this code line
unit = print("L(lbs) or (k)g: ") with below line
unit = input("L(lbs) or (k)g: ")
Here is the complete correct code, you can also copy and paste for getting result:
weight = int(input('Weight: '))
unit = input("L(lbs) or (K)g: ")
if unit.upper() == āLā:
converted = weight * 0.45
print(f"Your weight is {converted} kilos")
else:
converted = weight / 0.45
print(f"Your weight is {converted} pounds")
Thanks