Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Created October 12, 2022 14:09
Show Gist options
  • Select an option

  • Save RaMSFT/12e2e4c04f20babdf630875b039996c8 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/12e2e4c04f20babdf630875b039996c8 to your computer and use it in GitHub Desktop.
def calculate_fuel(distnace):
"""Returns the fuel required for given distance
Args:
distnace (number)
Returns:
number: fuel required is 10 times the distance when it is above 100, else 100
"""
fuel = distnace * 10
if fuel >= 100:
return fuel
else:
return 100
print(calculate_fuel(15))
print(calculate_fuel(23.5))
print(calculate_fuel(3))
print(calculate_fuel(120))
print(calculate_fuel(9))
print(calculate_fuel(10))
print(calculate_fuel(12))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment