daily pastebin goal
88%
SHARE
TWEET

Untitled

viKKyo Feb 14th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # read in name
  2. # split name (" "), move to list
  3. # :3 of first element of list, :3 of second element of list, move to emailString
  4. # attach @student.hh.se to emailString
  5. nameList = []
  6. name = input("What's your first and last name? \n").lower()
  7. emailString = ""
  8. testString = ""
  9.  
  10. def createEmail(name):
  11.     emailString = ""
  12.     nameList = name.split(" ")
  13.     if len(nameList) == 3:
  14.         for item in nameList[:1]:
  15.             if len(item[:3]) != 3:
  16.                 emailString += item[:2]
  17.             else:
  18.                 emailString += item[:3]
  19.         for item in nameList[2:3]:                        
  20.             if len(item[:3]) == 3:
  21.                 emailString += item[:3]
  22.     else:
  23.         for item in nameList:
  24.             if len(item[:3]) != 3:
  25.                 emailString += item[:2]
  26.             else:
  27.                 emailString += item[:3]
  28.                
  29.     emailString += "@student.hh.se"
  30.     return emailString
  31.  
  32. def createEmailList(classlist):
  33.     classList = []
  34.     with open(classlist, "r") as data:
  35.         for line in data:
  36.             classList.append(line.strip("\n"))
  37.         for line in classList:
  38.             print(createEmail(line))
  39.    
  40.  
  41.    
  42.  
  43. print("Your email would be:", createEmail(name))
  44. print("All emails in classlist.txt are:", createEmailList(classlist.txt)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top