lundi 2 août 2021

High/low game in python

'''

import random

correct_num = random.randint(0,10)

guess = int(input('What is your guess?'))
while guess != correct_num:
    if guess > correct_num:
        print('Your guess is to big')
    if guess < correct_num:
        print('Your guess is to small')
    else:
        if guess == correct_num:
            print('Yes! You are correct')

'''

This is what I have so far, when I run the code it prints the output infinitely. How can I make it give one output and go back for another guess?

Aucun commentaire:

Enregistrer un commentaire