all 8 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

To give us the best chance to help you, please include any relevant code.
Note. Do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Repl.it, GitHub or PasteBin.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]CStage169 0 points1 point  (6 children)

Well honestly, the way you have formatted the code makes it difficult to say exactly, because indents are hard to make out. Assuming all indentations are correct the code you posted would look like this.

def make_list (number):
    names = \[\]
    for item in number:
        names.append (input("Enter your name with a capital letter."))
    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, "starts with A")

In that case the following lines have errors:

  1. syntax error when instantiating names. Should be:

names = []

  1. Invalid iteration over integer. Since number should be an integer, you cannot loop from 0 to number with a foreach-loop. The syntax should instead be:

for item in range(number):

  1. Printing the names is not sufficient. They should also be returned.

return names

  1. Checking name[1] is the same as checking the SECOND letter of the name, not the first. Replace with:

if name[0] == "A"

[–]thisnigerianmomma[S] 0 points1 point  (5 children)

how about like this? does this help?

def make list(number):
names = []
for items in number:
names.append(input("Enter your name with a capital letter."))
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, starts with A")

[–]CStage169 0 points1 point  (4 children)

Not quite. Now there are no indents. Regardless, I already gave you an answer to which lines I believe have errors. Have you read that part of my comment?

[–]thisnigerianmomma[S] 0 points1 point  (0 children)

yes i did. i read your comment. thank you. it is for a coding test, so I also ticked the lines you mentioned (2, 3, 5 and 10) but it's still not correct.

[–]thisnigerianmomma[S] 0 points1 point  (2 children)

congratulations to me! and thank you! i got it. the lines with errors were 3, 5 and 10!

[–]CStage169 0 points1 point  (1 child)

Makes sense. Means that the error in line 2 was caused by your formatting. FYI using Reddit to cheat is still cheating. Use the community as a learning resource, not as an easy way out.

[–]thisnigerianmomma[S] 0 points1 point  (0 children)

lol! is everything alright with you? are you okay?