#usernames1.py #Sharon Persinger #This program creates a file of usernames from a file of names. #A username is the first letter of the first name follwed by #the first 7 letters of the last name. #This version reads the entire file of names into a list of lines and #processes the list. def main(): #open the input file and read the lines into a list infile = open("names20.txt", 'r') thenames = infile.readlines() infile.close() #open the output file outfile = open("users1.txt", 'w') for each in thenames: first, last = each.split() #break into first and last names u = first[0] + last[0:7] #create the user name print(u, file = outfile) #print the user name to the output file outfile.close() main()