Created
November 20, 2017 21:46
-
-
Save Manuela82/57f90c7a0967134095a12ebbf662dfd2 to your computer and use it in GitHub Desktop.
guess_the_secret_number_main_and_random
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
| import random | |
| secret = 28 | |
| print "Welcome to 'Guess the secret number'" | |
| def main(): | |
| while True: | |
| random_num = random.randint(0, 29) | |
| print "You don't know which number you want to choose? You can take our randomly created number:" " " \ | |
| + str(random_num) | |
| guess = int(raw_input("Guess the secret number (between: 1 and 30): ")) | |
| if guess == secret: | |
| print "You guessed it - congratulations! It's number 22:)" | |
| break | |
| else: | |
| print "Sorry, your guess is not correct... Secret number is not " + str(guess) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment