Created
September 17, 2018 13:32
-
-
Save beltiras/8c4c7b1a1cf01b16d6c55b281ccc398e to your computer and use it in GitHub Desktop.
This file contains 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
start = int(input("Input a position between 1 and 10:")) | |
position = start | |
if start > 10 or start < 1: | |
exit() | |
print("l - for moving left") | |
print("r - for moving right") | |
print("Any other letter for quitting") | |
while True: | |
move = input("Input your choice:") | |
if move not in "lr": | |
exit() | |
if move == "l": | |
position -= 1 | |
if position < 1: | |
position = 1 | |
if move == "r": | |
position += 1 | |
if position > 10: | |
position = 10 | |
print("New position is:",position) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment