Skip to content

Exercise 18 - Loops #144

Description

@MorganaVo

Hey, quick heads-up on the code. We should change the condition to "if guess == 6: " at the end.
Right now, with guess != 6, if a player actually hits the correct number 6 on their 5th try, the logic flips, and the game still tells them 'You ran out of tries'. Swapping it to == 6 will fix this glitch and make the win fair!

guess = 0
tries = 0

while guess != 6 and tries < 5:
guess = int(input('Guess the number: '))
tries = tries +1

if guess ==6:
print('you got it')
else:
print('no more tries')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions