In a make task you use the skills you have learned to create a program from scratch. There is no starter code: you begin with an empty editor.
This one is an independent challenge. It is short, but it puts three things together at once: a list, input from the user, and replacing an item in a list by assigning to its index.
The program shows a list of five names, lets the user say who they are and which place in the list they want, and puts them there in place of whoever was standing in it.
So that the output can be checked automatically, the five names are fixed. Start your program with exactly this line:
names = ["Alex", "Anita", "Patrick", "Atif", "Sue"]
print, exactly as written:
What is your name?
Enter a number between 0 and 4:
Cast it with int(), because it is going to be used as an index.
Read both answers with a bare input() on the line after its question.
Your program prints exactly four lines: the list before the change, the two questions, and the list after the change.
The first line is the same every time the program runs:
['Alex', 'Anita', 'Patrick', 'Atif', 'Sue']
The next two lines are the two questions, printed exactly as written above.
The fourth line is the same list with one name swapped for the one the user typed. It still has five items, with the square brackets, quotes and commas that Python puts round a printed list:
['Alex', 'Anita', 'Tom', 'Atif', 'Sue']
Input:
Tom
2
Output:
['Alex', 'Anita', 'Patrick', 'Atif', 'Sue']
What is your name?
Enter a number between 0 and 4:
['Alex', 'Anita', 'Tom', 'Atif', 'Sue']
(Tom takes the place of Patrick, the item at index 2)
Input:
Jo
0
Output:
['Alex', 'Anita', 'Patrick', 'Atif', 'Sue']
What is your name?
Enter a number between 0 and 4:
['Jo', 'Anita', 'Patrick', 'Atif', 'Sue']
(index 0 is the first name, so Alex is the one that goes)
Input:
Mary Jane
4
Output:
['Alex', 'Anita', 'Patrick', 'Atif', 'Sue']
What is your name?
Enter a number between 0 and 4:
['Alex', 'Anita', 'Patrick', 'Atif', 'Mary Jane']
(index 4 is the last name, because a five-item list has no index 5)
Both questions are part of the output that is checked here, so their spelling,
capital letters and punctuation count. Ask each one with its own print,
exactly What is your name? and Enter a number between 0 and 4:, and read
the answer with a bare input() on the next line, rather than passing the
question to input(...).
Make sure that you check for the following things:
int() before it is used as an
index.= has the index after it, as in
names[position] = your_name. Without the index you would replace the whole
list with one name.