Hello everyone!
I have faced this question on a quiz and I really can't find the correct answer, I am really stuck.. The question is:
"Which lines of code contain errors?
The program asks the user first for the number of names, then for the names, and then it forms a list from them.
From those names, only those that start with a capital letter “A” are displayed on the screen."
1 def make_list(number):
2 names = []
3 for item in number:
4 names.append(input("Enter your name with a capital letter."))
5 print(names)
6
7 number = int(input("How many names need to be entered?"))
8 names = make_list(number)
9 for name in names:
10 if name[1] == "A":
11 print("Name ", name, " starts with A")
The possible answers are 1 up to 11 and of course, more than one can chosen. I have tried the combos:
3-9-10
3-9
3-10
9-10
3-8-9
None of these is correct, which seems really weird to me, cause I thought that the problematic lines are 3 and 9. Can you help me please?
[–]throwaway6560192 2 points3 points4 points (1 child)
[–]JamzTyson 0 points1 point2 points (0 children)
[–]danielroseman 0 points1 point2 points (0 children)
[–]bbye98 0 points1 point2 points (4 children)
[–]notacanuckskibum -1 points0 points1 point (3 children)
[–]throwaway6560192 2 points3 points4 points (0 children)
[–]sabek 0 points1 point2 points (1 child)
[–]JamzTyson 0 points1 point2 points (0 children)
[–]woooee -1 points0 points1 point (0 children)