What's wrong with this bit of Python? Entering the names does not work.
def main():
print("This program generates computer usernames.\n")
# get user's first and last names
first = input("Please enter your first name (all lowercase): ")
last = input("Please enter your last name (all lowercase): ")
# concatenate first initial with 7 chars of the last name
uname = first[0] + last[:7]
# output the username
print("Your username is:", uname)
main()
Now, running the program results in this -- no idea what it's all about.
cd '/Users/ek/Desktop/' && '/usr/bin/pythonw' '/Users/ek/Desktop/fun.py' && echo Exit status: $? && exit 1
EKs-Mac-mini:~ ek$ cd '/Users/ek/Desktop/' && '/usr/bin/pythonw' '/Users/ek/Desktop/fun.py' && echo Exit status: $? && exit 1
This program generates computer usernames.
Please enter your first name (all lowercase): Bob
Traceback (most recent call last):
File "/Users/ek/Desktop/fun.py", line 14, in <module>
main()
File "/Users/ek/Desktop/fun.py", line 5, in main
first = input("Please enter your first name (all lowercase): ")
File "<string>", line 1, in <module>
NameError: name 'Bob' is not defined
EKs-Mac-mini:Desktop ek$