Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Numbered list
#2
Is there a question? I would not that with a break statement you can simplify your input loop quite a bit:

def name_pres():
    while True:
         pres = input("Enter the name of your favorite presidents in order <done to end>: ")
         if pres == "done":
             break
If you want to do anything with those names you are going to need to store them. Probably by starting with an empty list and then using the append method each time a new name is entered.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Numbered list - by sheriff2001 - Oct-22-2019, 01:46 PM
RE: Numbered list - by ichabod801 - Oct-22-2019, 02:12 PM
RE: Numbered list - by sheriff2001 - Oct-22-2019, 02:31 PM
RE: Numbered list - by ichabod801 - Oct-22-2019, 03:29 PM

Forum Jump:

User Panel Messages

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