August 2025
💾
Files
Challenge Instructions
A common topic for AS papers and occasionally asked about for IG/O-Level is file handling
Here are some example programs you could try to create
- Read and output a txt file of a story - e.g. Shakespeare
- Copy all lines/the first n lines/last n lines/every other line from one file to a new file
- Copy all lines starting with a certain string to a new file
- Create a program that can encrypt a message and write it to a file - then another module/program to decrypt it
- Create a simple encoding using emojis - e.g. "5R4B" could mean 5 red circles, followed by 4 blue circles. Your program would read this text file and display the image from these coloured circle/square emojis
- Count number of lines/characters/words/paragraphs in a file
- Output a specific/range of lines from a file based on the line numbers
- Read a file and display the line number alongside each line
- Remove empty lines from a file
- Parse a .csv file (can ignore commas enclosed within quotes - keep it simple if you want)
- Sort the lines of a file alphabetically
- Merge multiple files into a single file
- Create a custom encoding which you can write/read from a file
- Split large files into multiple smaller ones - e.g. max of 10 lines
- Create a login program - log successful/unsuccessful attempts to a file along with the date/time - could be used by system admit to detect brute force login attempts
- Create a menu that allows the user to enter a filename, then read/write/append to it
...etc - there are many different examples you can think of
As a target, let's try and have 10 programs submitted by members of the community for others to enjoy...good luck...and have fun!
Top Submissions
Submission Instructions
Create your program on the editor page, then click the upload button at the bottom of the code editor as shown below
Once you are confident your program is working well without obvious bugs, then give it a relevant name, choose the current monthly challenge from the dropdown box, choose some program categories if you want and submit it :)
Note: your submitted programs will be in blue and you can overwrite them by opening them, clicking the upload button again and selecting "overwrite"