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.

CoderSports

Write To & Append A File

Need more help with file handling?

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

Write a program that:

  • Defines two new functions to add singer & add band to the appropriate files.
  • Reads and outputs the contents of the singers list and the bands list to the user.
  • Asks the user if they want to input a new singer or new band (choose 1 for singer, 2 for band).
  • Validates the input.
  • Gets the user to input a singer or band that they want to add to the appropriate file, and passes that input into the appropriate function.
  • Asks the user if they want to continue (c) or quit (q).
  • Validates the input.
  • Repeats asking the user if they want to continue, (c), or quit (q).

Help! My code doesn’t work

Make sure that you check for the following things:

  • Include the file extension (.txt) in the file name
  • Use the exact same file variable with open and in the loop.
  • Use exactly the same case in the filename.
  • Indenting all the code that should be inside loops.
  • Close the file once task is completed.

Hints