Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) 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

1) 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 from ‘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:

2) Write a function scrabble_score(word) that takes as input a string word containing only lowercase letters, and that uses recursion to compute and return the scrabble score of that string – i.e., the sum of the scrabble scores of its letters.

3) Write a function compare(s1, s2) that takes as inputs two strings s1 and s2 (which you can assume have the same length) and uses recursion to compare two strings and to return the number of positions at which they have different characters

4) Write a function weave(vals1, vals2) that takes as inputs two lists vals1 and vals2 and uses recursion to construct and return a new list that is formed by “weaving” together the elements in the lists vals1 and vals2 to create a single list. The new list should alternate elements from the two lists: the first element from vals1, followed by the first element from vals2, followed by the second element from vals1, followed by the second element from vals2, etc.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer Here are the implementations for the functions you requested in Python Func... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A Balanced Introduction to Computer Science

Authors: David Reed

3rd edition

132166755, 978-0132166751

More Books

Students also viewed these Programming questions

Question

What are two numbers that are 23 away from 0 ?

Answered: 1 week ago