#Python #course #tutorial
Python exercises for beginners
# Python weight converter
weight = float(input("Enter your weight: "))
unit = input("Kilograms or Pounds? (K or L): ")
if unit == "K":
weight = weight * 2.205
unit = "Lbs."
print(f"Your weight is: {round(weight, 1)} {unit}")
elif unit == "L":
weight = weight / 2.205
unit = "Kgs."
print(f"Your weight is: {round(weight, 1)} {unit}")
else:
print(f"{unit} was not valid")
Python exercises for beginners
# Python weight converter
weight = float(input("Enter your weight: "))
unit = input("Kilograms or Pounds? (K or L): ")
if unit == "K":
weight = weight * 2.205
unit = "Lbs."
print(f"Your weight is: {round(weight, 1)} {unit}")
elif unit == "L":
weight = weight / 2.205
unit = "Kgs."
print(f"Your weight is: {round(weight, 1)} {unit}")
else:
print(f"{unit} was not valid")
- Category
- Bro Code
- Tags
- Python tutorial for beginners, Python course

Be the first to comment