-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteambuilder.py
54 lines (36 loc) · 1.2 KB
/
teambuilder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# create roster of team members
import random, sys, os, math
# Initiate empty list
teammate = []
# Loop to gather team members
while True:
print('Type the name of a team member ' + str(len(teammate) + 1) + ' and press enter. Enter nothing and press Enter to stop: ')
name = input()
if name == '':
break
teammate = teammate + [name]
# Print list when finished entering
print('The team is:')
for name in teammate:
print(' ' + name)
# Iterate slightly differently
for i in range(len(teammate)):
print ('Index ' + str(i) + ' in teammates list is: ' + teammate[i])
# Sort the iterate again
teammate.sort()
for i in range(len(teammate)):
print ('Index ' + str(i) + ' in sorted teammates list is: ' + teammate[i])
# Reverse the sort
teammate.sort(reverse=True)
for i in range(len(teammate)):
print ('Index ' + str(i) + ' in teammates Reverse Sort list is: ' + teammate[i])
# Find index position of team member
while True:
print('If there is someone you want to search for, Type the name here. Enter nothing to finish without searching.')
firstname = input()
if name == '':
sys.exit()
print (teammate.index(firstname))
print('Done.')
sys.exit()
# End