8000 small changes · georgecms/complete-python-course@1755cab · GitHub
[go: up one dir, main page]

Skip to content

Commit 1755cab

Browse files
committed
small changes
1 parent fb9736b commit 1755cab

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

course_contents/1_intro/notes/01. Data Types.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,13 @@ Data types representing True bool:
110110

111111
`shopping_list[2] # cherries`
112112

113-
- Elements in a list can be accessed in a range:
114-
115-
`shopping_list[0:2] # ['cereals', 'milk']`
116-
117-
- If the list is too big to count the elements, the last one can be accessed with a shortcut:
118-
`shopping_list[-1] # cherries`
119-
120-
121-
- A list can be reversed:
122-
123-
`shopping_list[::-1] # ['cherries', 'milk', 'cereals']`
124-
125113

126114

127115
### Tuples
128116
- A tuple is very much like a list, however:
129-
- A tuple is an ordered sequential data type which is **unchangeable**
117+
- A tuple is an ordered sequential data type which is **immutable**
130118
- A tuple is created by a sequence of elements separated by a comma
131-
- For better readability, it is surrounded by parenthesis
119+
- For better readability, it can be surrounded by parenthesis
132120

133121
Example:
134122

@@ -141,9 +129,9 @@ Example:
141129
`better_readability = ('with', 'parenthesis')`
142130

143131
### Sets
144-
- A set is an **unordered** sequential data type
145-
- A set's element cannot be accessed by its index
146-
- A set is created by a pair of curly brackets:
132+
- A set is an **unordered** data type
133+
- Elements of a set cannot be accessed by their indices
134+
- A set is created by a single pair of curly brackets:
147135

148136
`shopping_list = {'apples', 'milk', 'cherries'}`
149137

@@ -155,11 +143,7 @@ curly braces, keys and values
155143

156144
Example:
157145
```
158-
employees = {
159-
'ID': 16915,
160-
'name': 'James',
161-
'department': ['Sales', 'Accounting']
162-
}
146+
employees = {'ID': 16915, 'name': 'James', 'department': ['Sales', 'Accounting']}
163147
```
164148

165149
- A dictionary is accessed by keys as such:

0 commit comments

Comments
 (0)
0