Skip to content

Instantly share code, notes, and snippets.

@nonaybay
Last active April 7, 2021 21:28
Show Gist options
  • Save nonaybay/ca9117f1b17b0186eebba374d0708ac2 to your computer and use it in GitHub Desktop.
Save nonaybay/ca9117f1b17b0186eebba374d0708ac2 to your computer and use it in GitHub Desktop.
# Port from rust-lang Guessing Game:
# link: https://doc.rust-lang.org/book/ch02-00-guessing-game-tutorial.html
import random
SN = random.randint(0, 101)
def main():
print('+ Guess the number')
ug = int(input('+ Please, input your guess: '))
print('+ OK! Your guess <{}>'.format(ug))
if (ug != SN):
if (ug < SN):
print('\n\n- too small!\n\n+ Try again!\n')
main()
else:
print('\n\n- too big!\n\n+ Try again!\n')
main()
else:
print('\n\n\n\n~ ! ! ! ! y o u w i n ! ! ! ! ~\n\n\n\n')
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment