Skip to content
murmot

Results for “python while loop example program site:discuss.python.org”

  • discuss.python.org

    How to write a loop with conditions - Python Help ...

    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 ...

  • discuss.python.org

    Python learning while loop list

    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 . # ...

  • discuss.python.org

    While loop Problem - Python Help - Discussions on Python.org

    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 ...

  • discuss.python.org

    Repeat while loop? - Python Help - Discussions on Python.org

    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?

  • discuss.python.org

    Nested While Loops - Python Help - Discussions on Python.org

    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 ...