Gallery
Solution Class List
Share
Explore
Solution Class List

icon picker
Solution

Solution

solution
# array of strings used to store list of pupil names
classList = ['Robby Keene', 'Tory Nichols', 'Eli Moskowitz', 'Miguel Diaz', 'Demetri Alexopoulos', 'Samantha LaRusso', 'Devon Lee', 'Kenny Payne', 'Moon', 'Mr Miyagi']

# display a blank line
print('\n')

# display the 1st pupil
print(classList[0])
# display a blank line
print('\n')

# display the last pupil
print(classList[9])
# display a blank line
print('\n')

# display pupil at the position input by user
position = int(input('Enter position of pupil: '))
print(classList[position])

# display a blank line
print('\n')

# display first 5 pupils
for i in range(0, 5, 1):
print(classList[i])
# end loop
# display a blank line
print('\n')

# display all the pupil
for i in range(0, 10, 1):
print(classList[i])
# end loop


original
# array of strings used to store list of pupil names
classList = ['Robby Keene', 'Tory Nichols', 'Eli Moskowitz', 'Miguel Diaz', 'Demetri Alexopoulos', 'Samantha LaRusso', 'Devon Lee', 'Kenny Payne', 'Moon']

# display a blank line
print('\n')

# display the 1st pupil

# display the last pupil


# display pupil at the position input by user



# display first 5 pupils

# display all the pupils
Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.