Question: Use PYTHON !!! NOT Java or anything else!! Function name : crazy_scrabble Parameters : word (string), current points (int), double word score (boolean) Returns: int

Use PYTHON!!! NOT Java or anything else!!

Function name : crazy_scrabble Parameters : word (string), current points (int), double word score (boolean) Returns: int Description : You are playing scrabble with a friend, and you thought you knew how to calculate how many points you have, but your friend suddenly starts making up all these crazy rules. Write a function that helps keep track of how many points you have with these new rules:

  • Each 'k', 'm', 'p', 'x', 'y', and 'z' earns you 7 points.

  • 'c' and 's' are worth 4 points each.

  • Each vowel ('a','e','i','o','u') you causes you to lose 2 points.

  • All other letters are worth 1 point.

  • Each time a letter is reused in a word, the player loses 1 point.

  • If your word is more than 6 letters long, you get a bonus of 3 points.

  • If the double word score is True and the point total for the word is positive ( > 0),

    the player receives double the points for the word.

    The function should return the players new point total. Assume that the words will not be empty strings and will only consist of lowercase letters from a to z.

    Note: A player cannot have an overall negative point total. Return 0 if the point total would be negative after the new word the player has played. For example, if a player currently has 7 points but would lose 9 points from their new word, the player should have 0 points now, not -2 points.

Test Cases:

>>> crazy_scrabble('xylophone', 25, False) 45 
>>> crazy_scrabble('seal', 0, True) 2 
>>> crazy_scrabble('oranges', 7, True) 15 

REMEMBER, PLEASE USE PYTHON ONLY

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!