Jelena Adamovic_pokusaj

mail@pastecode.io avatar
unknown
python
11 days ago
883 B
4
Indexable
Never
# Import the random module
import random
#enter guest number

repetition = 1
# Main execution
if __name__ == "__main__":
    # Generate a random number between 1 and 100
    random_number = random.randint(1, 100)
while (repetition <= 10):
    guess_number_game = int(input(f'your number {repetition}: '))

    if ((guess_number_game <= 100) & (guess_number_game >= 1)) :
        if random_number != guess_number_game:
            print("Please try again")
        if random_number == guess_number_game:
            print("Congratulations, you won")
            break
    if guess_number_game > 100:
        print("Please enter number in range 1-100")
    if guess_number_game < 1:
        print("Please enter number in range 1-100")
    repetition += 1
print(f"Random number is: {random_number}")
if repetition >= 10:
    print(f"Please try for 24h again")
Leave a Comment