Hi there is an logical error in this code i am not able to figure it out please little help will be appreciated | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

29th Dec 2018, 5:04 PM
Sumesh Dhyani
6 Answers
+ 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
29th Dec 2018, 6:02 PM
just trying to think
just trying to think - avatar
+ 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!
29th Dec 2018, 6:31 PM
just trying to think
just trying to think - avatar
+ 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 .
29th Dec 2018, 5:38 PM
Sumesh Dhyani
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!
29th Dec 2018, 5:25 PM
just trying to think
just trying to think - avatar
0
Man you are great it worked what did you do please explain
29th Dec 2018, 6:19 PM
Sumesh Dhyani
0
Thanks, you really helped
29th Dec 2018, 6:40 PM
Sumesh Dhyani