python/players.py

28 lines
668 B
Python

players = ['charles', 'martina', 'michael', 'florence', 'eli']
# slice the list beginning with the first index element through the 2nd index
# element; thus 3 elements
#print(players[0:3])
# slice the list starting with index[0] and stopping at index[3]
#print(players[:4])
# slice the list beginning at index[2] or 3rd element and ending at the end of
# the list
#print(players[2:])
# if you want to slice the list and print the last 3 elements in the list, use
# this
print(players[-3:])
# printing the first three players on my team in title case
print("Here are the first three players on my team:")
for player in players[:3]:
print(player.title())