fuel = input()
liters = float(input())
if liters >= 25:
if fuel == "diesel" or "gasolin" or "gas":
print(f"You have enough {fuel}.")
else:
print("Invalid fuel!") # Why that not work
elif liters < 25:
if fuel == "diesel" or "gasolin" or "gas":
print(f"Fill your tank with {fuel}!")
else:
print("Invalid fuel!") # Why that not work
else:
print("Invalid fuel!") # Why that not work
Asked
Active
Viewed 31 times
-1

martineau
- 119,623
- 25
- 170
- 301
-
python input() always returns a string try converting it to int or float. – user655941 Sep 16 '21 at 14:11
-
Your comparison line is incorrect. Try this: – Gustavo Araújo Sep 16 '21 at 14:12
-
if fuel == "diesel" or fuel == "gasolin" or fuel == "gas": – Gustavo Araújo Sep 16 '21 at 14:12
1 Answers
-1
fuel == "diesel" or "gasolin" or "gas"
shuold be changed to fuel in ("diesel", "gasolin", "gas")
because at the moment the only comparison is fuel and diesel.

Squidtoon99
- 1
- 1