-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.py
More file actions
32 lines (26 loc) · 686 Bytes
/
Copy pathlist.py
File metadata and controls
32 lines (26 loc) · 686 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
list = ["apple","Banna","chery","apple","Banna","chery"]
print(list)
print(len(list))
print(type(list))
print (list[3])
print (list[-4])
print (list[2:5])
print (list[:5])
thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(thislist[-4:-1])
thislist = ["apple", "banana", "cherry"]
if "apple" in thislist:
print("Yes, 'apple' is in the fruits list")
my = ["apple", "banana", "cherry"]
my[1] = "blackcurrant"
my.append("Lemon")
print(my)
thislist = ["apple", "banana", "cherry"]
thislist.pop(1)
print(thislist)
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
newlist = []
for x in fruits:
if "a" in x:
newlist.append(x)
print(newlist)