8.27 LAB: Scrabble points Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex: If the input is: PYTHON the output is: 14   Use Python for this.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

8.27 LAB: Scrabble points

Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board.

Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board).

Ex: If the input is:

PYTHON

the output is:

14

 

Use Python for this.

**Lab Activity: 8.27.1 - Scrabble Points**

**Description**

This lab involves writing code to calculate the score of words in a Scrabble game using the provided `tile_dict` dictionary.

**Code Snippet:**

```python
tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8,
              'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1,
              'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 }

# Type your code here.
```

**Instructions:**

1. The provided dictionary, `tile_dict`, assigns a point value to each letter from A to Z, similar to the official Scrabble scoring system.
2. Your task is to write a function or piece of code that computes the total score of a given word based on these letter values.

**Note:**

- The editor is set up for you to enter your code below the comment `# Type your code here.` 
- Ensure that your code reads the word input and correctly accumulates the total score using the values from the dictionary.

**Usage Example:**

If a user inputs the word "HELLO," your code should calculate and return the total score by summing the values for each letter: 
H(4) + E(1) + L(1) + L(1) + O(1) = 8 points.

**Next Steps:**

- Explore ways to handle invalid characters or inputs.
Transcribed Image Text:**Lab Activity: 8.27.1 - Scrabble Points** **Description** This lab involves writing code to calculate the score of words in a Scrabble game using the provided `tile_dict` dictionary. **Code Snippet:** ```python tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1, 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } # Type your code here. ``` **Instructions:** 1. The provided dictionary, `tile_dict`, assigns a point value to each letter from A to Z, similar to the official Scrabble scoring system. 2. Your task is to write a function or piece of code that computes the total score of a given word based on these letter values. **Note:** - The editor is set up for you to enter your code below the comment `# Type your code here.` - Ensure that your code reads the word input and correctly accumulates the total score using the values from the dictionary. **Usage Example:** If a user inputs the word "HELLO," your code should calculate and return the total score by summing the values for each letter: H(4) + E(1) + L(1) + L(1) + O(1) = 8 points. **Next Steps:** - Explore ways to handle invalid characters or inputs.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Parallel Processing
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education