replit

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.

Output A Range Of Items From A List

Need more help with lists? Click here

Make

What’s a ‘Make’ Task?

In these tasks you have to use the skills learned in the previous exercises to create a new program based on the requirements below.

Task Instructions – Class List

Write a program that:

  • Stores 10 names in a list
  • Asks the user to input 1 to choose output range, 2 to choose output from a point to the end of the list or 3 to choose output from the beginning of the list to a point.
  • Validates the input and does not continue until it is suitable.
  • Depending on the option chosen asks the user to input relevant start/end points.
  • Outputs the relevant items from the list.

Extra challenge

  • Code the three different outputs as separate subroutines and call them when needed.

Help! My code doesn’t work

Make sure that you check for the following things:

  • Square brackets for items in the list
  • Commas between each item in the list.
  • String items are in quotation marks
  • Range – the end value is NOT included in the output.
  • Search – not initialising counter OUTSIDE the loop.
  • Search – not incrementing counter INSIDE the loop.

Hints