-
Notifications
You must be signed in to change notification settings - Fork 0
/
tuple_slice_notes_starter.py
63 lines (46 loc) · 1.59 KB
/
tuple_slice_notes_starter.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
55
56
57
58
59
60
61
62
63
# tuple_slice_notes_starter.py
# Indexing & slicing tuples and the .choice() function
import random
# creating tuples: The Cubs World Series game 7 lineup (in correct batting order)
# and corresponding positions
cubs = ("Dexter Fowler",
"Kyle Schwarber",
"Kris Bryant",
"Anthony Rizzo",
"Ben Zobrist",
"Addison Russell",
"Willson Contreras",
"Jason Heyward",
"Javier Baez")
pos = ("CF",
"DH",
"3B",
"1B",
"LF",
"SS",
"C",
"RF",
"2B")
# INDEXING
# Display 1 element: Anthony Rizzo
# Display from multiple tuples: Dexter Fowler CF
# CHALLENGE #1
# Display all Cub outfield players using indexing
input("\nPress enter to begin CHALLENGE 1: ")
# Use indexing to print a statement that says:
# “The World Series MVP is Ben Zobrist, LF”
# SLICING
# Display 2 slices: 1 showing the Cubs first 3 batters and 1 showing their
# next 6 batters
# CHALLENGE #2
# Display 2 slices showing the Cubs first 4 batters and their positions
# (in tuple format)
input("\nPress enter to begin CHALLENGE 2: ")
# Selecting a random element with .randrange()
# Selecting a random element with .choice()
# CHALLENGE #3
# Create a 3rd tuple to hold all jersey numbers.
# Select a random Cub using random.choice() and print info for batters in the
# lineup, up to and including the random batter(table format & using a for loop)
input("\nPress enter to begin CHALLENGE 3: ")
input("Press enter to exit.")