Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flow Control Help
#2
One way:
#! /usr/bin/env python3

acceptable = ['r', 'p', 's', 'q']

while True:
    print(f'Allowed input - {", ".join(acceptable)}')
    choose = input('>> ').lower()

    if choose == 'q':
        break
    if choose in acceptable:
        print(f'{choose} is allowed.')
    else:
        print(f'{choose} is not allowed')
BashBedlam likes this post
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply


Messages In This Thread
Flow Control Help - by RoadToSensei - Feb-13-2022, 08:11 PM
RE: Flow Control Help - by menator01 - Feb-13-2022, 08:15 PM
RE: Flow Control Help - by RoadToSensei - Feb-13-2022, 09:02 PM
RE: Flow Control Help - by deanhystad - Feb-13-2022, 10:38 PM
RE: Flow Control Help - by BashBedlam - Feb-14-2022, 01:51 AM
RE: Flow Control Help - by deanhystad - Feb-14-2022, 08:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Alicat Flow Meter data acquisition marenr 0 420 Sep-29-2023, 10:59 PM
Last Post: marenr
  Node Flow Generation in Python Linenloid 0 735 Feb-21-2023, 07:09 PM
Last Post: Linenloid
  Understanding Raspberry PI RTS/CTS flow control zazas321 2 3,799 Oct-30-2020, 09:55 AM
Last Post: zazas321
  Understanding Raspberry PI RTS/CTS flow control zazas321 0 1,595 Oct-30-2020, 08:02 AM
Last Post: zazas321
  Reproducing assignment with min cost flow in networkx mntfr 0 2,211 Jun-13-2019, 04:06 PM
Last Post: mntfr
  Find Maximum Flow for graph with infinite capacities Dav 6 4,480 Apr-16-2019, 02:08 PM
Last Post: Dav
  program flow advice sampazzer 2 3,225 Aug-05-2017, 09:34 PM
Last Post: sampazzer
  Trouble with general code flow JCN 1 3,483 May-26-2017, 01:27 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020