-
Notifications
You must be signed in to change notification settings - Fork 1
/
ops301d3-opschallenge09.py
58 lines (31 loc) · 1.06 KB
/
ops301d3-opschallenge09.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
#!/usr/bin/env python3
# Script Name automation.py
# Author Bill Kachersky
# Date of last revision 09/10/2021
# Description of purpose Make a list of string elements, then pull and modify certain elements
# Variable(s)
automation = ('carrot', 'pumpkin', 'zucchini', 'corn', 'cucumber', \
'ginger', 'shallot', 'pepper', 'celery', 'tomato')
print ()
# Main
# Print the list to the screen.
print ("Here's a list of ten string elements... I think?")
print (*automation)
print()
# Print the fourth element of the list.
print("Here's the fourth element: ")
print(*automation[3:4])
print()
# Print the sixth through tenth element of the list.
print("Here's 6 through 10: ")
print(*automation[5:10])
print()
# Change the value of the seventh element to “onion”.
print ("And for my final trick, let's change element 7 to 'onion':")
res = [sub.replace('shallot', 'onion')for sub in automation]
print(*res)
print()
# Acknowledge completion
print("done")
print()
# End