Please use python with executed tests
3. Scrabble. Scrabble is a game in which each word is given a score by adding up the value of each letter. Scoring is as follows: • 1 point for A, E, I, O, N, R, T, L, S, or U. 2 points for D or G. 3 points for B, C, M, or P. 4 points for F, H, V, W, or Y. 5 points for K. .8 points for J or X. • 10 points for Q or Z. Write a function scrabble_score (word) that takes a str containing only upper-case English letters (A - Z), and returns the Scrabble score of that word. For example: check.expect("S:YO", scrabble_score("YO"), 4 + 1) check.expect("S:LOCKJAW", scrabble_score("LOCKJAW"), 1+1+3+5+8+1+4) Write a function best_word (words) that takes a List[str] containing only upper-case English letters (A - Z), and returns the item from words that has the highest Scrabble score. In the case of a tie, return the word closest to the front of words. For example, check.expect("B:SQUID", best_word (["SPORE", "SQUID", "CHAIR", "APPLE"]), "SQUID") check.expect("B:5", best_word(["TEN", "SODA", "TIDE", "TOE", "BEE", "EUROS"]), "SODA") (Your function might only work when words has length at least 1. Write requirements as needed.) Exercise Exercise
Please use python with executed tests
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am