Advertisement
KaySawbridge

Abbreviating Team Names

Jul 27th, 2020
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. from random import choice
  2. teams = ["WOLVES", "OWLS", "PANTHERS", "BEARS", "DRAGONS"]
  3. teams_short = [] #create empty list for results
  4. for i in teams:
  5.     abbreviation=i[:3] #add the first 3 letters of the team name to a variable)
  6.     teams_short.append(abbreviation) #add the contents of the variable to the new list
  7.    
  8. print(teams_short)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement