Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=====================================#
- #==============MODULES================#
- #=====================================#
- #=====================================#
- #==============VARIABLES==============#
- #=====================================#
- menus = ["(1) Create Username", "(2) Exit "]
- usernameList = []
- #=====================================#
- #==============FUNCTIONS==============#
- #=====================================#
- #defines menu
- def menu(paramter):
- print " +===================+"
- print " | Menu |"
- print " |-------------------|"
- for word in parameter:
- print " |%s|" % word
- print " |-------------------|"
- #creates username and checks to see if name is already taken
- def usr(usernameList):
- firstname = raw_input("Please enter your first name: ").lower()
- lastname = raw_input("Please enter your last name: ").lower()
- #create username First character in firstname and and characters 6 characters from lastname
- username = firstname[0] + lastname[:7]
- #username check
- if username in usernameList:
- print "The username %s is not available." % username
- print
- num = input("Please enter a number(1-9): ")
- new_username = (firstname[0] + lastname[:6] + str(num))
- #add "new_username" to list
- usernameList.append(new_username)
- print "The username %s has been created." % new_username
- else:
- #add "username" to list
- usernameList.append(username)
- print "The username %s has been created." % username
- #=====================================#
- #=============MAIN PROGRAM============#
- #=====================================#
- def main():
- menu(menus)
- choice = input("Please make a selection(1-2): ")
- if choice == 1:
- usr(usernameList)
- elif choice ==2:
- print "Exiting Program. Goodbye"
- return
- else:
- print "Invalid Selection"
- return main()
Advertisement
Add Comment
Please, Sign In to add comment