-5

I want to know where I have mistakes in my codes I am trying to fix it , hope someone will help )

def make_list(number) :
names = []
for item in number:

names.append(input("Enter your name') )
print (names)

number = int(input("How many names need to be entered?"))
names = make_list(number)
for name in names:
if name[1] == "A":
print("Name", name, “Starting from the work A")
  • 1
    Please fix the indentation and then let us know what is going wrong... and what you'd like to happen. If you are getting an error, post that message. – tdelaney Jul 04 '22 at 17:26
  • @tdelaney I have the Error IndentationError: expected an indented block at line 2 – Jena Travolta Jul 04 '22 at 17:30
  • 1
    Welcome to Stack Overflow! Please take the time to read [how to ask a good question](https://stackoverflow.com/help/how-to-ask). The title should ideally be a summary of your question. An extensive answer as to why your code is not working: https://stackoverflow.com/a/45621723/14804838. – Caspar V. Jul 05 '22 at 22:33

1 Answers1

-2

I hope I've fixed all the indentations:

def make_list(number) : # function to make a list of numbers
    names = [] # create an empty list
    for i in range(number): # range(number) is a list of numbers from 0 to number-1
        names.append(input("Enter your name: ")) # append() adds an element to the end of the list
    
    return names # return the list

number = int(input("How many names need to be entered?")) # ask the user for the number of names
names = make_list(number) # call the function make_list()
for name in names: # for each name in the list
    if name[1] == "A": # if the second letter of the name is "A"
        print("Vmsa", name, "Starting from the work A") # print the name and the message
Ameya
  • 504
  • 3
  • 12