Scrabble Challenge

scrabbleThis challenge consists of creating a computer program that displays a random selection of 7 letters to the end-user. Each letter is given a value based on the values used in the game of Scrabble.

The user is then asked to enter a word made up using the given letters used in any order.

The program should check that the word given by the end user consists of the right letters and then calculate the score of the word based on the letter used and their values.

For instance the word “CODING” would give a score of 3 + 1 + 2 + 1 + 1 + 2 = 10

Note that for this challenge we assume that the user will give a valid English word! We will not expect the computer to check that the word actually exists in the English Language.

Learning Objectives

By completing this challenge you will discover the difference between a list and a dictionary, two data structures that can be used in Python.

You may want to read more about [lists] and about {dictionaries} first.

Complete the code

We have started the code for you. As you can see this code uses a list called randomLetters to store the value of the 7 randomly picked letters.
It also uses a dictionary called letterValues to store the value of each letter of the alphabet (Based on the game of Scrabble).

You now need to complete this code to finish the game…

Share Button
Posted in Computer Science, Python - Advanced, Python Challenges Tagged with: ,

Our Latest Book