-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLists
More file actions
25 lines (16 loc) · 872 Bytes
/
Lists
File metadata and controls
25 lines (16 loc) · 872 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
// In the Python3 Course, we're taught how to make lists using this simple code:
variable = [1, 2, 3, 4]
sam_height_and_testscore = ["Sam", 67, 85.5, True]
// You can make a list with all the different types of data in Python (string, integer, float, boolean)
// CodeAcademy Tells Us: A list begins and ends with square brackets ([ and ]).
// Each item (i.e., 67 or 70) is separated by a comma (,)
// It’s considered good practice to insert a space () after each comma, but your code will run just fine if you forget the space.
// Append & Delete are used to either Add or remove data at the end of a list.
example_list = [1, 2, 3, 4, 5]
example_list.remove(5)
print(example_list)
// The program above will delete 5 from the list.
example_list = [1, 2, 3, 4]
example_list.append(5)
print(example_list)
// The program above will add the number 5 to the list.