+ 1
Hi there is an logical error in this code i am not able to figure it out please little help will be appreciated
Here is the link of the code if anyone can help me out thanks in advance https://code.sololearn.com/cJlBcwxv3FUp/?ref=app
6 odpowiedzi
+ 2
Hi again,
I moved game cycle and 'if answer is correct' to loop for the chances.
That's all.
P.S: I have changed amount of numbers from 100 to 10 so it would be much easier. :) (Did you really want 100 numbers?)
https://code.sololearn.com/c3L9OkeDYLHZ
+ 2
i've moved this:
while Guess_Number != 'Secreat_Number':
if Guess_Number < Secreat_Number:
print("Your Guess is low ")
Guess_Number = int(input("Enter you number : "))
break
elif Guess_Number > Secreat_Number:
print("Your Guess is high ")
Guess_Number = int(input("Enter you number : "))
break
# I added this
else:
continue
to 'while life>0' cycle.
And from 'game code block' I've moved this:
if Guess_Number == Secreat_Number:
print("You guessed it right!")
break
to 'while life>0' cycle.
I hope that I explained this.
Good luck!
+ 1
Thanks, it helped but still there is a logical error in the code i know the error but i am new to programming so i am not able to rectify it .
0
Hi there,
The problem in SoloLearn's code playground. It doesn't support inputs in a cycles. Try this code on another compiler like that: https://www.onlinegdb.com/online_python_compiler
Good luck!
0
Man you are great it worked what did you do please explain
0
Thanks, you really helped