- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
Latest commit
37 lines (27 loc) · 574 Bytes
/
Copy pathexample.py
File metadata and controls
37 lines (27 loc) · 574 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
29
30
31
32
33
34
35
36
37
fromArrayListimportArrayList
# Create a new list
list=ArrayList(10)
# Add items to the list
list.add(1)
list.add(2)
list.add(3)
list.add(4)
list.add(5)
# Print the list
print(list)
# Remove an item from the list
list.remove(3)
# Print the list
print(list)
# Check if an item is in the list
print(list.search(3))
print(list.search(4))
# Get an item from the list
print(list.get(2))
# Print the length of the list
print(len(list))
# Print the list
print(list)
# Iterate over the list
foriteminlist:
print("\t", item)