In this lab, you will: Use input() to read line Use for loop to go over all symbols in the line Use created a dictionary to get the corresponding value for a certain key Instructions 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 (keys) and point (values) that takes a word as input and outputs the base total value of the word (before being put onto a board). Implement function create_scrabble to calculate the total points for the given string (the function's parameter) and return the value for the word. Outside the function, print the total value for the word. Ex: If the input is: PYTHON the output is: 14   def create_scrabble (user_input):     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 }      if __name__ == "__main__":

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

In this lab, you will:

  • Use input() to read line
  • Use for loop to go over all symbols in the line
  • Use created a dictionary to get the corresponding value for a certain key

Instructions

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 (keys) and point (values) that takes a word as input and outputs the base total value of the word (before being put onto a board). Implement function create_scrabble to calculate the total points for the given string (the function's parameter) and return the value for the word. Outside the function, print the total value for the word.

Ex: If the input is:

PYTHON

the output is:

14

 

def create_scrabble (user_input):
    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 }
    
if __name__ == "__main__":

 

Expert Solution
Algorithm:

Step-1: Start
Step-2: Declare a variable and take input from user
Step-3: Call a function create_scrabble(user_input):
 Step-3.1: Create a dictionary 
 Step-3.2: Declare a variable point to calculate the values
 Step-3.3: Iterate each letter given by user and compare with dictionary item if match then add the value in point
 Step-3.4: Print point
Step-4: Stop 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
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