+ 3

Please give a answer

Why is this not working? https://code.sololearn.com/WyjfybjR1QKX/#

5th May 2020, 1:19 PM
Leon Shrestha
Leon Shrestha - avatar
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
5th May 2020, 8:08 PM
NightFox
NightFox - avatar
+ 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
5th May 2020, 1:59 PM
Ahnaf
Ahnaf - avatar
+ 3
5th May 2020, 2:11 PM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 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 :))
5th May 2020, 2:59 PM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 2
Ahnaf Not actually, I didn’t change anything, I just added the game lost :))
5th May 2020, 3:05 PM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 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
5th May 2020, 2:01 PM
Ahnaf
Ahnaf - avatar
+ 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.
5th May 2020, 2:21 PM
NightFox
NightFox - avatar
+ 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
7th May 2020, 7:35 AM
Justine Chilufya
Justine Chilufya - avatar
0
Ahnaf Did you get what he wants to do? I modified the code according to his code and it is working :))
5th May 2020, 3:02 PM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
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)
7th May 2020, 2:15 AM
Alfonso Hernandez
Alfonso Hernandez - avatar
0
Hi
7th May 2020, 11:37 AM
mosayeb