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: ...
Discussions on Python.org. Need help understanding this while loop.Examples of using a while loop: Monitoring the temperature of a system. Shut system off when ambient temperature reaches 180 F.
Jan 11, 2022 · Hello, I have to write a loop that prompts a user for their age in a program that outputs an admission price for a cinema ticket (depending on the user’s age) I have just started writing basic loops like this one below, but I don’t even know where to start regarding creating loops where there are conditions, can someone point me in the right direction please? Regards Simon prompt ...
Sep 19, 2022 ... Here's an example that may help you understand how to use a while-loop with a list. Suppose you want to print each element of a list my_list . # ...
Jun 18, 2024 · A while loop means “repeat the following block of code until the condition is not met.” The loop is set to run while (i < 18), but then i is overwritten by i=int (input (“Enter your height:”)). So any value for height less than 18 will cause the loop to stop once it finishes the current iteration. To my eye the loop logic is a bit odd, because it at least starts examining the age (in ...
Dec 21, 2022 ... The while loop does not effect code outside the loop except that changes to variables and data inside the loop will be seen outside the loop ...
Oct 28, 2021 · Hello! So, Im trying to figure out how to repeat a while loop. I want my loop to restart completely, like if I’m making a game and I want a round two. I’ve tried looking online but it always confused me what is going on… anyone mind helping me out?
Nov 8, 2022 ... actually breaks out of the first while loop, which I don't think was your intention. A more general piece of advice, your program has way too ...
Oct 20, 2021 · Thanks. You can use nested for loops controlled by the user’s input. Here is a suggested header for the outer loop: ... Are you familiar with the documentation on the official Python web site? See Built-in Functions. The following may be particularly helpful for this project. chr () ord () Those functions may help you translate between ...
Oct 1, 2023 ... Welcome! Please post code as text not pictures. Its very hard to read the images. See About the Python Help category for how to do this.