Untitled
unknown
plain_text
2 years ago
1.3 kB
29
Indexable
#!/usr/bin/env python # coding: utf-8 # In[3]: marks=[] n = int(input("enter the number")) for i in range(n): value = int(input("enter elements")) marks.append(value) print(marks) newmarks = [] for x in marks: if x not in newmarks: newmarks.append(x) print(newmarks) # In[22]: #example music = [] n = int(input("enter the no of songs: ")) for i in range(n): songs = input("enter the song: ") if songs not in music: music.append(songs) print(music) # In[21]: #slipno28b list1 = [] n = int(input("enter no of element in list1: ")) for i in range(n): value = int(input("enter element:")) list1.append(value) list2= [] n = int(input("enter no of element in list2:")) for i in range(n): value = int(input("enter element : ")) list2.append(value) print("list1: ", list1) print("list1: ", list2) tuple1 = tuple(list1+list2) print(tuple1) # In[37]: #slipno22 list1 =[] n = int(input("enter elements: ")) for i in range(n): value = int(input("enter element:")) list1.append(value) print("unsorted list are ",list1) for i in range(0,len(list1)-1): for j in range(len(list1)-1): if list1[j]>list1[j+1]: temp = list1[j] list1[j] = list1[j+1] list1[j+1] = temp print("sorted list= ",list1) # In[ ]:
Editor is loading...