Skip to content

Instantly share code, notes, and snippets.

@acbart
Created August 12, 2022 16:07
Show Gist options
  • Save acbart/8127d96897ce96db1d8d5fed7bac5945 to your computer and use it in GitHub Desktop.
Save acbart/8127d96897ce96db1d8d5fed7bac5945 to your computer and use it in GitHub Desktop.
Tracing Ifs Example Vehicles
travellers = 4
suitcases = 3
bookbags = 2
def choose_vehicle(travellers: int, bags: int) -> str:
space = bags // 2 + travellers
if space > 4:
return 'van'
elif space <= 1:
return 'bike'
else:
return 'car'
vehicle = choose_vehicle(travellers, suitcases + bookbags)
print("You should get a", vehicle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment