#๐Ÿ”’ how to make so my while loop only prints once and once again once the menu is opene again

14 messages ยท Page 1 of 1 (latest)

night cipherBOT
#

@valid sage

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

valid sage
#

it prints a whole lot of time

wet citrus
#

You need to stop the while loop

valid sage
#

how do i do it again

#

do i have to make it a function

wet citrus
#

I will set your code and share it with you.

#

while is_running:
    print("Choose something")
    print("1. Withdraw")

    choice = input("Option: ")
    
    if choice == "1":
        print("Processing withdrawal...")
    else:
        print("Not a valid option")

    is_running = False  # This ensures the loop runs only once
night cipherBOT
#

Hey @wet citrus!

Please edit your message to use a code block

Add a py after the three backticks.

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
valid sage
#

thanks sir

wet citrus
wet citrus
# valid sage thanks sir

Is it OK? after once loop is running you need to enter a one variable in which you set it to a False Value

#

If you need any kind of further help DM me

night cipherBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.