+ 3
Please give a answer
Why is this not working? https://code.sololearn.com/WyjfybjR1QKX/#
13 Respuestas
+ 10
Hi! This question is no where related to your device. And please don't spam by writing multiple answers. This is a question answer forum, so we can't chat herd. Please try to post all the answers in a single answer. More answers results in users getting multiple notifications, which is really annoying. I hope you understood, Thank you! Read this:
https://www.sololearn.com/discuss/1316935/?ref=app
+ 5
I found the problem here. You have a mistake in the while loop condition. You wrote
while(guessedCorrect = false)
But it should be
while (guessedCorrect == false)
Since you are using the equal condition, you need to use two equal signs for using it in a loop or conditional statement
+ 3
Leon Shrestha Hello, here is the corrected code :))
https://code.sololearn.com/WjYTeR9Dy47c/?ref=app
+ 2
Ahnaf Your code is a infinite loop. Please use a condition, use break or remove the code. I had to restart the app.
And my code is working fine :))
+ 2
Ahnaf Not actually, I didn’t change anything, I just added the game lost :))
+ 1
You even did not ever use the prompter value and that's why it won't work after the first solution. You need to use the prompter as the value the user guessed. Check my code for the solution.
https://code.sololearn.com/WoXakVA2uB85/?ref=app
+ 1
Ahnaf It is eventually an infinite loop. The asker of this question must edit the contents inside the while loop, otherwise, the user is stuck there until the right number is guessed.
+ 1
You need to define guess which is in line 15 and also the while loop isn't correct, it need to be
while (guessedCorrect == false)
Because it is two equal signs that mean equal to
0
Ahnaf Did you get what he wants to do? I modified the code according to his code and it is working :))
0
Hi can somebody help me to explain this:
e = lambda x: True if x == 0 else o(x -1)
o = lambda x: not e(x)
print("even" if e(10 // 2) else "odd")
This appeard in a challenge, i won in this just cause I thought if x == 0 so if e(10//2) it is not 0 I selected "odd" cause I knew it that it was not 0, but I don't understand what about o(x-1)
0
Hi