Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Simple Python Problem: 3. Write a function letter_score(letter) that takes a lowercase letter as input and returns the value of that letter as a scrabble
Simple Python Problem:
3. Write a function letter_score(letter) that takes a lowercase letter as input and returns the value of that letter as a scrabble tile. If letter is not a lowercase letter fronm 'a' to 'z, the function should return 0. This function does not require recursion. Here is the mapping of letters to scores that you should use: For example: letter_scoreC'w' 4 print(letter_score('q' 10 >>> etter-score('%") # not a letter >>> letter-score('A') # not lower-case We encourage you to begin with the following template def letter_score(letter): your docstring goes here""" assert(len(letter)1) # put the rest of your function here Note that we begin with an assert statement that validates the input for the parameter letter. If the condition given to assert is not true-in this case, if the input provided for d has a length other than 0-then assert will cause your code to crash with an AssertionError. Using assert in this way can help you to find and debug situations in which you accidentally pass in incorrect values for the parameter of a functionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started