Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Created October 18, 2022 03:59
Show Gist options
  • Select an option

  • Save RaMSFT/1139d9785c33f8079ef7eead963185f6 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/1139d9785c33f8079ef7eead963185f6 to your computer and use it in GitHub Desktop.
def on_off_switch(switches):
# ** operator in Python works as power
posibilities = 2 ** switches
return posibilities
print(on_off_switch(1))
print(on_off_switch(3))
print(on_off_switch(10))
print(on_off_switch(21))
print(on_off_switch(24))
print(on_off_switch(4))
print(on_off_switch(6))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment