-
Notifications
You must be signed in to change notification settings - Fork 0
/
Data_Structures.py
51 lines (42 loc) · 1.94 KB
/
Data_Structures.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
import pprint
cata = {'name': 'Zophie', 'age': 7, 'color': 'gray'}
allCats = []
allCats.append({'name': 'Zophie', 'age': 7, 'color': 'gray'})
allCats.append({'name': 'Pooka', 'age': 5, 'color': 'blck'})
allCats.append({'name': 'Fat-Fail', 'age': 5, 'color': 'gray'})
allCats.append({'name': 'Zophie', 'age': 7, 'color': 'gray'})
##################################################################
theBoard = {'top-L': '', 'mid-M': '', 'low-L': '', 'top-M': '',
'mid-M': '', 'low-M': '', 'top-R': '', 'mid-R': '', 'low-R': ''}
pprint.pprint(theBoard)
theBoard['mid-M'] = 'X'
pprint.pprint(theBoard)
theBoard['top-L'] = 'O'
theBoard['top-M'] = 'O'
theBoard['top-R'] = 'O'
theBoard['mid-L'] = 'X'
theBoard['low-R'] = 'X'
def printBoard(board):
print(board['top-L'] + '|' + board['top-M'] + '|' + board['top-R'])
print('---------------------------------------------------------')
print(board['mid-L'] + '|' + board['mid-M'] + '|' + board['mid-R'])
print('---------------------------------------------------------')
print(board['low-L'] + '|' + board['low-M'] + '|' + board['low-R'])
type(42) # class Int
type('hello') # class String
type(3.14) # class Float
type(theBoard) # class Dict
text = 'That is Alice cars'
text = 'That is Alice`s cars'
print('Hello there!\n How are you? \n I\'m fine.')
print(r'That is Carlos\'s cat')
spam = """ Dear Alice, Eves cat has been arrested for catnapping, cat burglary, and extortion. Sincerely, Bob. """
"""
- Strings can begin and end with double quotes.
- Espace characters let you put quotes and other characters that are hard to type inside strings.
- Raw strings will literally print any backslashes in the string and ignore espace characters.
- Multiline strings being and end with three quotes, and can span multiple lines.
- Indexes, slices, and the in and not in operators all work with strings.
"""