The correction have an issue on 8/19

#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

the `guess = int(raw_input("Your guess: "))` before the while loop is considered fair by the correction

<What do you expect to happen instead?>

By putting this previous statement before the loop : if with answer well at first try its ok but if we answer bad it end the prog without displaying : â€śyou loseâ€ť

Of course all happends well when we put the statement at the first statement of the wile

``````

from random import randint

# Generates a number from 1 through 10 inclusive
random_number = randint(1, 10)
print random_number

guesses_left = 3
# Start your game!

guess = int(raw_input("Your guess: ")) #the wrong place but the correction said me it's right ...
while guesses_left >=0:
#guess = int(raw_input("Your guess: ")) # the good place
if guess == random_number:
print "You win!"
break

guesses_left -=1

else:
"You lose."

``````

#2

Hi @seb16120,

Are you using the correct condition here? â€¦

``````while guesses_left >=0:
``````

The user is allowed three guesses. If any of them is correct, the program should display `You win!` and terminate. If none of the three guesses is correct, it should terminate and display `You lose.` without allowing any more guesses.

#3

i think yes because its a countdown : count -=1

edit : oh it give me 4 try â€¦ its just an < the right condition ^^

But the sujet of the topic is that a wrong answer is considerate as a good answer if we reach a statement is as the answer expected by the correction

#4

What condition will you be using to control the loop? Please post the revised loop header.

Now letâ€™s consider where the user should be prompted for a guess. You could do it both prior to the loop and within the loop.

#5
``````from random import randint

# Generates a number from 1 through 10 inclusive
random_number = randint(1, 10)
print random_number

guesses_left = 3
# Start your game!

while guesses_left >0:
guess = int(raw_input("Your guess: "))
if guess == random_number:
print "You win!"
break

guesses_left -=1

else:
"You lose."
``````

#6

This displays a message correctly when the user wins â€¦

``````    print "You win!"
``````

However, can this statement ever display a message? â€¦

``````  "You lose."
``````

Something is missing from that statement.

#7

XDDDDDDDDDDDDDDD

iâ€™m dumb â€¦ i forget the print in front of â€śyou loseâ€ť â€¦

edit : a another reason to said the auto-correction implemented is â€¦ improvable (for not saying bad)

but i guess itâ€™s because no many people learn python.
So i guess the auto-correction is better on another langage.

#8

The program that checks your submitted code for each exercise is a submission correctness test (SCT). It can catch most of the common mistakes, but unfortunately it is not perfect.

#9

i have a little idea how it work ^^

So I can try to be indulgent

edit : and itâ€™s improve my self-correction on what iâ€™m doing ^^

#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.