write a python write a program to input a list names of persons and then print all such names which begins with letter a and ends with letter n
Chapter: List Manipulation
Answers
Answered by
12
It goes like:
#making list
a=int(input ("Enter the list length: "))
lis=[]
for i in range (0,a):
b=input("Enter the name: ")
lis.append(b)
#printing from list as per condition
for j in lis:
if (j[0]=="a" ) and j[-1]=="n":
print(j)
If you're having trouble understanding the latex consider the attachment,
Attachments:
![](https://hi-static.z-dn.net/files/dc4/d86c28f7d8ba14488ac78175aad41de2.jpg)
Similar questions