QUESTION DESCRIPTION
Write a program to append two list and find the list index of the list element
Input:
1. The Size of First List
2. The Size of Second List
3. First List elements
4. Second List elements
5. First List Element to be searched
6. Second List Element to be searched
Output:
1. Extended List or appended list
2. The index of the first list element (entered by user, Step 5)
3. The index of the second list element (entered by user, Step 6)
Write a program to append two list and find the list index of the list element
Input:
1. The Size of First List
2. The Size of Second List
3. First List elements
4. Second List elements
5. First List Element to be searched
6. Second List Element to be searched
Output:
1. Extended List or appended list
2. The index of the first list element (entered by user, Step 5)
3. The index of the second list element (entered by user, Step 6)
an=int(input())
bn=int(input())
l1=[]
l2=[]
el=[]
for i in range(0,an):
v1=int(input())
l1.append(v1)
for i in range(0,bn):
v2=int(input())
l2.append(v2)
el=l1+l2
n=len(el)
print("The Extended List")
print(el)
s1=int(input())
s2=int(input())
for i in range (0,n):
if el[i]==s1:
print('Index for',s1,'=',i)
for i in range (0,n):
if el[i]==s2:
print('Index for',s2,'=',i)
Comments
Post a Comment