Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fuel = input()
- liter = float(input())
- if fuel == "Diesel" or fuel == "Gasoline" or fuel == "Gas":
- if liter >= 25:
- print(f'You have enough {fuel.lower()}.')
- else:
- print(f'Fill your tank with {fuel.lower()}!')
- else:
- print('Invalid fuel!')
- Или с тернарен оператор:
- fuel = input().lower()
- liter = float(input())
- if fuel in ("diesel", "gasoline", "gas"):
- print(f'You have enough {fuel}.' if liter >= 25 else f'Fill your tank with {fuel}!')
- else:
- print('Invalid fuel!')
- Или тарикатската:)
- fuel = input().lower()
- print((f'You have enough {fuel}.' if float(input()) >= 25 else f'Fill your tank with {fuel}!')
- if fuel in ("diesel", "gasoline", "gas") else 'Invalid fuel!')
Add Comment
Please, Sign In to add comment