Drop links or images here to add them to the editor.

In a make task you write the program yourself, from an empty editor.

A local restaurant wants a simple program to save customer feedback ratings into a text file.

Your task

Write a program that:

The file holds only the most recent rating. If feedback.txt already holds older feedback, that is replaced, not added to.

The tests also check your code: use int() to read the rating.

The output

The two questions come first, in this order and worded exactly like this:

Enter your name
Enter your rating out of 10

Then one last line, once the file has been written and closed:

Feedback saved

The file

feedback.txt holds one line, where NAME is the name the user typed and RATING the rating:

NAME - RATING

There is a space on either side of the hyphen. The line may end with a "\n" or not: with only one line in the file, either is fine.

Example

Input:

Sam
8

Output:

Enter your name
Enter your rating out of 10
Feedback saved

feedback.txt afterwards:

Sam - 8

Ask each question with its own print, and read the answer with a bare input() on the next line, rather than passing the question to input(...). The questions are part of the output that is checked here, so their spelling, capital letters and punctuation count. So does the line in the file.

Help! My code doesn't work!

Make sure that you check for the following things:

  • The file is called feedback.txt, spelled exactly like that.
  • The mode is "w", so old feedback is wiped. With "a", a file that already holds a rating ends up with two.
  • The rating goes through str() before it is joined onto the name. write only takes text.
  • The spaces around the hyphen are inside the quotes: " - ".
  • The file is closed before Feedback saved is printed.