-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrays.py
More file actions
28 lines (20 loc) · 958 Bytes
/
Arrays.py
File metadata and controls
28 lines (20 loc) · 958 Bytes
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
################################################################################
# TITLE: Arrays in Python
# DESCRIPTION: How to use store multiple items in the same variable
################################################################################
def main():
print('This is an example of an Array')
# index 0 1 2 3
people = ['Nick', 'Steve', 'John', 'Mary']
print(people[2]) # 2 is referring to string at index 2 which is John
print(people[0])
print('This is an example of a two-dimensional Array')
# group 0 1
# -------------------------------------------------
# index 0 1 2 0 1 2
colors = ['blue','white','red'], ['quarter', 'half', 'full']
print(colors[1][2])
print(colors[0][0])
if __name__ == "__main__":
# Here we start the program by calling the main method
main()