list1=[]
print("Enter 10 elements of your choice")
for i in range(10):
numb=int(input())
list1.append(numb)
def indexofsmallestelement(list1):
test=min(list1)
indx=[]
for i in range(0,len(list1)):
if test==list1[i]:
indx.append(i)
return indx
print("The list of indices of smallest number in the list provided is: ", indexofsmallestelement(list1))
if len(indexofsmallestelement(list1))>1:
smallindex=indexofsmallestelement(list1)[0]
print("And the smallest index of the smallest number is: ", smallindex)
print("Enter 10 names of your choice")
names=[]
for i in range(10):
name=str(input())
names.append(name)
def mostcommonname(lst):
common=[]
count=1
for i in lst:
word_count=lst.count(i)
if word_count>count:
count=word_count
common.append(i)
return common
print("The most common names in the list are: ", mostcommonname(names))
print("Enter 10 names of your choice")
names=[]
for i in range(10):
name=str(input())
names.append(name)
def mostcommonname(lst):
common=[(lst.count(i),i) for i in lst]
max_ele=max(common)[0]
comm_elem=[]
for x in common:
if x[0]==max_ele:
comm_elem.append(x[1])
return comm_elem
if comm_elem==[]:
print("None")
print("The common names in the given list are ", set(mostcommonname(names)))
Enter 10 names of your choice
print("Enter 10 elements of your choice")
ele=[]
for i in range(10):
x=input()
ele.append(x)
print(ele)
def isPalindromicList(a):
if ele==ele[::-1]:
palindrom=True
else:
palindrom=False
return palindrom
isPalindromicList(ele)