Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import uuid
- import os
- import random as r
- '''
- This code was written for quiz no. 1 on the 30/04/2018
- '''
- GENERATED_UUID = str(uuid.uuid4())
- username = os.getlogin()
- print("***************************************")
- print(" Hello {} ".format(username))
- print(" Secret {} ".format(GENERATED_UUID))
- print("***************************************")
- while True:
- user_password = input("Please enter the code: ")
- if user_password == GENERATED_UUID[-4:]:
- is_guessed = False
- random_number = r.randint(0, 10)
- print("[---------- You got the code right.")
- print("[---------- Now let's play the guessing game.")
- while is_guessed != True:
- guessed_number = input("Enter a random number from a certain range: ")
- guessed_number = int(guessed_number)
- if guessed_number == random_number:
- is_guessed = True
- print("You have cracked the program. Good job.")
- print("Submit the working code to the TrainerPS.")
- break
- else:
- print("Please try again...")
- else:
- print("Wrong password. Take a look at the secret for a hint.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement