Skip to content

Latest commit

 

History

History
30 lines (11 loc) · 2.1 KB

Challenges 51-60.md

File metadata and controls

30 lines (11 loc) · 2.1 KB

Challenges 51 - 60: "Shopping time baby!"

  1. Ask the user for their name and their score in a test. Also ask them what subject this score was for and store this in a 2D dictionary. When all the scores have been entered, ask for a name and show all the scores for that person across all subjects. You could also ask for a subject and show all the scores by individuals for that subject.

  2. Write a program that asks the user for items to add to a shopping list. When the shopping list is complete, create a file and write the items to the file.

  3. Write a program to read the items from a shopping list file and display them to the user.

  4. Write a program that asks the user what items they have bought and remove these from a shoppin list file.

  5. Create a dictionary file with words in alphabetical order. Write a series of subroutines to check if a word exists in the file, add new words to the file (maintaining the correct order) and remove words from the file.

  6. Ask the user for a pair of co-ordinates. Determine how far apart they are. Now extend the program to ask the user for a set of coordinates (you work out how to stop the inputs). Find the pair of coordinates that are closest to each other and the pair that are furthest from each other. Display these pairs with the distance between them.

  7. Ask the user for a nnumber between 5 and 20. Generate this number of random numbers between 2 and 50. Shuffle the numbers into two groups with the same total.

  8. Morse code. Find out what the codes are for Morse Code and write a program that can decode or encode a message. Use a . For a dot and a - for a dash. A single space should be used to indicate a new letter and two spaces to indicate a new word.

  9. Create a game of noughts and crosses where two players take turns. The program should determine who the winner is.

  10. Update your game so that the players choose how many games they will play. Your program should keep tabs on how many games each player wins. At the end it should announce who is the overall winner and how many individual games each player won. (Deal with the possibility of a draw!)