-
Notifications
You must be signed in to change notification settings - Fork 0
/
lists.py
63 lines (48 loc) · 1.11 KB
/
lists.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
52
53
54
55
56
57
58
59
60
61
62
#::: LISTS in Javascript called array
# fruits = ['apple', 'banana', 'mango', 'orange', 'grape']
# print(fruits)
# could by numbers
# numbers = [1,2,3,4,5,6]
# print(numbers)
# add number and string
# mixing = [1,2,'apple',3.142, 'banana',True]
# print(mixing)
fruits = ['apple', 'banana', 'mango', 'orange', 'grape']
#get value
# print(fruits[2])
#length
# print(len(fruits))
#append or add
# fruits.append('strawberry')
#remove
# fruits.remove('orange')
# print(fruits)
#insert
# fruits.insert(2,'melon')
# print(fruits)
# fruits.pop()
# print(fruits)
# fruits.reverse()
# print(fruits)
# fruits.sort()::: alphabetical order
# print(fruits)
#:::::::: TUPLES AND SET ::::::::::
#turples
# fruits = ('apple', 'banana', 'mango', 'orange', 'grape', 'apple')
# print(fruits.count('apple'))
# del fruits
# print(fruits[2])
#::: sets
fruits = {'banana', 'mango', 'orange', 'grape'}
# print(fruits)
# print('mango' in fruits)
# fruits.add('banana')
# print(fruits)
# fruits.remove('orange')
# print(fruits)
del fruits
print(fruits)
#:::: ASSIGNMENT
students = ["charles","Daniel","Zainab"]
print(len(students))
#:::::