Created
October 12, 2022 14:09
-
-
Save RaMSFT/12e2e4c04f20babdf630875b039996c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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