JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Class List
Share
Explore
Gallery
Class List
Class List
The Task
Code Clips
The Task
Activity: Arrays - Class List 👥
Start Here
Work in pairs.
Open the
main.py
file, explore and complete the following challenges.
Use the
CodeClips
file to find the code you need.
Add an additional pupil to the array so there are 10 pupils in total.
Prepare by reading the comments and identifying the missing code
Display the
first
pupil in the list.
Display the
last
pupil in the list.
Display the pupil at the position input by a user
Display the
first five
pupils in the list by traversing 5 elements of the array.
Display
all
the pupils in the list by traversing the whole array.
Good luck! 🍀
Sample output
First pupil:
Robby Keene
Last pupil:
Mr Miyagi
Pupil at position input by user:
Which position index do you want? 3
Miguel Diaz
First five pupils:
Robby Keene
Tory Nichols
Eli Moskowitz
Miguel Diaz
Demetri Alexopoulos
All pupils:
Robby Keene
Tory Nichols
Eli Moskowitz
Miguel Diaz
Demetri Alexopoulos
Samantha LaRusso
Devon Lee
Kenny Payne
Moon
Mr Miyagi
Gallery
Share
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.