-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlists.py
More file actions
57 lines (41 loc) · 1.16 KB
/
lists.py
File metadata and controls
57 lines (41 loc) · 1.16 KB
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
52
53
54
55
56
57
my_list = [1, 4, 60, 8000, -10, -1, -20, 2, 2, 3]
my_list.append(4)
# second_list = ["a", "b", "c"]
# my_list.extend(second_list)
# my_list.insert(1,'Ayham')
my_list.remove(2)
my_list.pop(0)
my_list.pop()
my_list.reverse()
my_list.sort()
# print(my_list)
third_list = ["ay", 'ba', "bb", "b", "c"]
third_list.sort()
# print(len(third_list))
my_tuple = (1, 2, 3, 4, 5)
# print(my_tuple[1])
my_tuple = (3, 7, 8)
# print(my_tuple)
# my_dict = {"name": "Ayham", "age": 25}
# print(f"my dictionary is {my_dict}")
# print('my dictionary is {}, my tuple is {} :)'.format(my_dict, my_tuple))
# print("my dictionary keys are: ", my_dict.keys())
# print("my dictionary values are: ", my_dict.values())
#
# my_dict["name"] = "Omar"
# print(my_dict)
#
# my_dict["city"] = "Cairo"
# my_dict.update({"age": 26})
# print(my_dict.get("name"))
# print(my_dict.get("city"))
# print(my_dict.get("country"))
# print(my_dict.get("country", "Egypt"))
# print(f"Omar's age = {my_dict["age"]}")
# my_dict.pop("age")
# print(my_dict)
my_set = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10}
print(my_set)
my_set.add(8)
my_set.add(11)
print(my_set)