Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I end my while loop
#6
(Jan-22-2021, 04:49 PM)BashBedlam Wrote: This is how I would go about it:

#getpass will hide what the person is typing during the password
import getpass
 
def new_entry():
  #input the username and password and the website
  Website = input("Enter the website: ")
  Username = getpass.getuser()
  Password = getpass.getpass()
  print (Password)

while True :
  print ('1. See the list\n2. Add new entry\n3. Exit now')
  choice = input ('')
  if choice == '1' :
    print ('You chose number one.\n') 
  elif choice == '2' :
    new_entry()
  elif choice == '3' :
    break
  else:
    print ("ERROR:\nInvalid input: Please type agian\n")
And just FYI, the line Username = getpass.getuser () is not getting input from the user it is grabbing the username of whoever is currently logged in to the computer that this is running on.

Yep thanks, noticed that and changed it.
Reply


Messages In This Thread
How do I end my while loop - by TechNitium - Jan-22-2021, 01:56 PM
RE: How do I end my while loop - by buran - Jan-22-2021, 02:08 PM
RE: How do I end my while loop - by TechNitium - Jan-22-2021, 02:33 PM
RE: How do I end my while loop - by buran - Jan-22-2021, 03:06 PM
RE: How do I end my while loop - by BashBedlam - Jan-22-2021, 04:49 PM
RE: How do I end my while loop - by TechNitium - Jan-22-2021, 05:07 PM

Forum Jump:

User Panel Messages

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