Need help understanding this while loop - Python discussion
Feb 13, 2024 ... I'm new to while loops, and I don't quite get what's going on in this code from my book: current_number = 1 while current_number <= 5: ...
Feb 13, 2024 ... I'm new to while loops, and I don't quite get what's going on in this code from my book: current_number = 1 while current_number <= 5: ...
Working on text input and outputs right now. 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.
Jun 9, 2022 ... ... find this variant readable while it occupies much less vertical space in the code: ... program it all linearly and learn about strings and loops.
Sep 19, 2022 ... Can any one help me understand how to write this code? I am using ... Here's an example that may help you understand how to use a while ...
Rather than while loop (where you would later have to “increment” your string to the next letter), why not make it a for loop?Hello, all! It is a good idea to format Python code for posting. Then it will be properly indented, and therefore easy for other users to copy and paste for testing.
Nov 3, 2023 ... = does not mean equality as it does in mathematics. To set counter to 0 you have this line of code: counter = 0. Inside the loop the value of ...
while is_word_guessed(secret_word, letters_guessed) == True: just to see if the change from True to None would break the loop. Anyway, any help pertaining to the mentioned function call or its use within the code as a whole would be greatly appreciated!
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?
Jun 4, 2026 ... That said, a while loop is concept related to control flow, they're not a python exclusive feature and basically any programming language uses ...