Help with a while loop - Python Discussions
Feb 5, 2024 ... I need help fixing up this while loop. When I place my answer I end up with the same answer “That is not A, B, C, D or E, ...
Feb 5, 2024 ... I need help fixing up this while loop. When I place my answer I end up with the same answer “That is not A, B, C, D or E, ...
I have while j < n in the first while loop and also in the inner loop. I could not see a way to simplify the two while j < n statements. It seems that both need to exist. Is it common for such sliding window questions? Is there any good way to simplify based on the current code?
auto while (True): row = file.readline() if row == "" #here the variable row is recognised. Interestingly here is also "" which to me means that Python sees that part as str, no?
Jan 28, 2023 ... You don't import time , though I suspect that you didn't copy the code exactly as you've been running it (there's a stray < there too).
My current code is supposed to count each letter that appears in a text document (“lyrics.txt”) and output the number of times each letter appears. The gets stuck in an infinite while loop though, and I’m not entirely sure why.
Jan 11, 2022 ... Otherwise, I don't see the need for a loop as yet. so basically, a while loop goes as follows: while expression . The expression should be ...
Nov 8, 2022 ... A non-empty string has a boolean value of True in Python, so the ... This code calculates BMI as long as input is correct. Now you can ...
The while loop gets rid of the need for (this use of) goto. It’s basically combines the if statement and the two goto statements into a single piece of code that restricts where control goes next.
Oct 18, 2022 ... Pease use code formatting. What will happen if you reach space? Counter is not advanced so it will loop endlessly.