Hi everyone, I just started learning Python 3.1 (never done programming before). I just wrote this useless little program. It seems to work but I would just like a little bit of feedback as to how well I executed the idea. Basically I want to know if I am making things hard for myself by going the long way about it or if it looks pretty efficient. Thanks guys, I promise I will help you too when I actually know what I'm doing :?:
import time
def addNames():
while True:
userInput = input('Please type a name to add to the list or "Q" when you are done...')
if userInput == 'q':
break
elif userInput == 'Q':
print('\n')
break
else:
names.append(userInput)
def printNames():
if not names:
print('\nThere are no names in the list...\n')
else:
print('\n'.join(names), "\n")
names = []
while True:
userInput = str.lower(input('What would you like to do?\nA) Add names?\nB) Print names?\nC) Quit\n'))
if userInput == 'a':
print('\n')
addNames()
elif userInput == 'b':
printNames()
elif userInput == 'c':
print('\nNow quitting program...')
time.sleep(3)
break
else:
print('\nPlease enter "A", "B" or "C"\n')