Before you start this course, you must login to Replit
If you have forgotten your Replit account user name or password, ask your Coder Coach.
If you have forgotten your Replit account user name or password, ask your Coder Coach.
In these tasks you have to use the skills learned in the previous exercises to create a new program based on the requirements below.
This task requires you to use lots of skills from earlier lessons. Don’t be afraid to look at your old code, google ideas and have fun with the dialogue. Good luck!
Write a program that simulates an encounter with a zombie in a video game.
Output item | Outputs a single item from the array. | print(arrayName[itemIndex]) print(sweets[3]) |
---|---|---|
Edit item | Changes or replaces an item in an array. | arrayName[itemIndex] = New data sweets[1] = “Haribo” |
Add an item | Puts a new item onto the end of the array | arrayName.append(new data) sweets.append(“Galaxy”) |
Remove an item | Removes an item from the array | arrayName.pop(itemIndex) sweets.pop(2) |
Output all items | Outputs every item in the array one by one using a loop. | for i in range(0, len(arrayName)): print(arrayName[i]) for i in range(0, len(sweets)): print(arrayName[i]) OR #This is a nice built in Python shortcut, but you need to know how to do the for loop version for the exam. print(sweets) |
Make sure that you check for the following things: