Learn
In this lesson you will learn how to write single values to each line. It will make use of the write mode in python.
Try
Write a program which will act as a notepad. It should
- Open a new file in write mode.
- Ask the user to enter sentences.
- When the user enters the word “done” it will stop.
Challenge
Create a simple maths game which will.
- Pick two random numbers.
- Display it as a sum “e.g. 5 + 9”
- Ask for the answer.
- Inform them if they are right or not.
- If it is correct, add 1 to a score.
- Repeat 10 times.
- Ask them for their name,
- Write the score and name to a file called “scores.txt”.