-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.py
More file actions
33 lines (30 loc) · 749 Bytes
/
sample.py
File metadata and controls
33 lines (30 loc) · 749 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
mylist = ['John', 15, 16.6, True, 'Vivek', 5+7j, 'Eric']
print(mylist[-2])
mylist[-3] = 'Singh'
print(mylist[-3])
mylist[-3] = 'Vivek'
print(mylist[-3])
list1 = list((1,2,3,4,5))
print(list1)
print(mylist)
list3 = mylist + ['Singh']
print(list3)
mylist = ['John', 15, 16.6, True, 'Vivek', 5+7j, 'Eric']
for x in mylist:
print(x,end=' ')
print('')
for i in range(-1,-len(mylist),-1):
print(mylist[i],end=' ')
L1 = [1,2,3,4,5]
print(L1)
L1[len(L1):] = [6]
print(L1)
L1[0:2].clear()
print(L1)
text = """Beautiful is better than ugly
Explicit is better than implicit Simple is
better than complex Complex is better than complicated """.lower()
unique_words = set()
for words in text.split():
unique_words.add(words)
print(unique_words)