20 CODE CHALLENGES
6
GCSE (9–1) COMPUTER SCIENCE
6
Max and min list
Write a program that lets the user input a list of numbers. Every time they input a new number, the program should give a message about what the maximum and minimum numbers
in the list are.
Extensions
1. The program should let the user choose the allowable minimum and maximum values, and should not let the user input something to the list that is outside of these bounds
2. The user should be able to write these values to a file and then also read them back out again.
3. If a file has any numbers outside of the boundaries, it should strip them out of the list once it has read them in.
7
Letter list
Write a program that lets a user choose a letter. The program will then find all the words beginning with that letter in a list and print them out. It should also say how many words it found.
Extensions:
1. Let the user load up a list of words from a file and have the program process them all
2. Change the program so that the user can choose whether they want all words with only the start of the letter, or ANY place in the word.
8
RPG character/Pokemon stat creator
Make a program which will randomly create a character’s stats based on several rules set by the user. Have it generate a class, gender, strength/magic/dexterity points, and extra abilities
or trades. Have the program save it to a file which can then be printed out so that it can be used in a game.
Extension:
1. Make a mystical name generator. Perhaps randomise different name parts such as sha-ra-lam or big-lim-con to create names for each of your randomly generated characters.
9
Quiz Maker
Make an application which takes various questions from a file, picked randomly, and puts together a quiz for students, and then reads a key to grade the quizzes. Each quiz can be different.
10
Check if Palindrome
Checks if the string entered by the user is a palindrome. A palindrome is a word that reads the same forwards as it does backwards like “racecar”.