Question

# def get_average_club_count(person_to_clubs: Dict[str, List[str]]) -> float: """Return the average number of clubs that a person in...

def get_average_club_count(person_to_clubs: Dict[str, List[str]]) -> float:
"""Return the average number of clubs that a person in person_to_clubs
belongs to.

>>> get_average_club_count(P2C)
1.6
>>> get_average_club_count({'Bob': ['X', 'Y'], 'John': []})
1.0
"""

This is the function I need to test for edge cases, I need to have a test case such that it will detect that the input has been modified(mutation). What test case would I implement?

```def get_average_club_count(person_to_clubs) -> float:
total = 0
for x in person_to_clubs.keys():
total+=len(person_to_clubs[x])

# Testing
print(get_average_club_count({'Bob': ['X', 'Y'], 'John': []}))```

#### Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
• ### def do_action(decision, game_data, current_location, inventory): ''' (int, dict, float, list) -> str Given the game data...

def do_action(decision, game_data, current_location, inventory): ''' (int, dict, float, list) -> str Given the game data dict, and the current location ID, get all the possible actions at that location. If the decision number given as 'decision' falls outside the number of allowed actions at this location, then return the string "Invalid decision. Please select choice from the decisions listed." Make sure this string is EXACTLY as above. Else, if the decision is valid, then figure out the location information...

• ### I am practicing python by doing some projects, and I am stuck on this function. I'd...

I am practicing python by doing some projects, and I am stuck on this function. I'd like to know how to do it without using statements like break, input, print, or continue. The first parameter represents a "person to friends" dictionary, the second parameter represents a "person to clubs" dictionary, and the third parameter represents a person's name in the same format as the dictionary keys). Using the recommendation system described below, the function should return the club recommendations for...

• ### Question 4a (2 points): Finding Edge Cases I This program is a partially correct solution to...

Question 4a (2 points): Finding Edge Cases I This program is a partially correct solution to the winning streak problem from a previous lab. Given a string, list, or tuple as input, find the longest winning streak. This solution contains an error. Find a test case that returns an incorrect value, or raises an error Do not modify or try to correct the code for this question, simply find a problematic input for the function # Modify the value of...

• ### The code: def isPalindrome(text): """ >>> isPalindrome("alula") True...

The code: def isPalindrome(text): """ >>> isPalindrome("alula") True >>> isPalindrome("love") False >>> isPalindrome("Madam") True >>> isPalindrome(12.5) False >>> isPalindrome(12.21) False >>> isPalindrome("Cigar? Toss it in a can.! It is so tragic.") True >>> isPalindrome("travel.. a town in Alaska") False """ # --- YOU CODE STARTS HERE if type(text) is not str: return False l = len(text) - 1 i = 0 while i < l: if text[i] in string.punctuation or text[i] == ' ': i += 1 elif text[l] in...

• ### Q1. Write a program to simulate a grocery waiting queue. Your program should ask the user...

Q1. Write a program to simulate a grocery waiting queue. Your program should ask the user if they want to add a customer to the queue, serve the next customer in the queue, or exit. When a customer is served or added to the queue, the program should print out the name of that customer and the remaining customers in the queue. The store has two queues: one is for normal customers, another is for VIP customers. Normal customers can...

• ### Implement a program that: reads a number of personal records (for example, using PERSON struct from...

Implement a program that: reads a number of personal records (for example, using PERSON struct from the earlier lab) from the standard input, creates a database of personal records, allows for adding new entries to the database, allows for deleting entries from the database, includes functions to acquire a record of personal data, and includes functions to display (print) a single selected record from the database, and also allows for printing all records in the database. NOTES: if name is...

• ### Java StringNode Case Study: Rewrite the following methods in the StringNode class shown below. Leave all...

Java StringNode Case Study: Rewrite the following methods in the StringNode class shown below. Leave all others intact and follow similar guidelines. The methods that need to be changed are in the code below. - Rewrite the indexOf() method. Remove the existing recursive implementation of the method, and replace it with one that uses iteration instead. - Rewrite the isPrefix() method so that it uses iteration. Remove the existing recursive implementation of the method, and replace it with one that...

• ### Coding for Python - The pattern detection problem – part 3: def pattern_search_max(data_series, pattern, threshold) Plea...

Coding for Python - The pattern detection problem – part 3: def pattern_search_max(data_series, pattern, threshold) Please do not use 'print' or 'input' statements. Context of the assignment is: In this assignment, your goal is to write a Python program to determine whether a given pattern appears in a data series, and if so, where it is located in the data series. Please see attachments below: We need to consider the following cases: Case 1 - It is possible that the...

• ### I need to complete the code by implementing the min function and the alpha betta pruning...

I need to complete the code by implementing the min function and the alpha betta pruning in order to complete the tic tac toe game using pything. code: # -*- coding: utf-8 -*- """ Created on: @author: """ import random from collections import namedtuple GameState = namedtuple('GameState', 'to_move, utility, board, moves') infinity = float('inf') game_result = { 1:"Player 1 Wins", -1:"Player 2 Wins", 0:"It is a Tie" } class Game: """To create a game, subclass this class and implement actions,...

• ### Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming...

Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game. After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then,...

Free Homework Help App

Need Online Homework Help?

Most questions answered within 3 hours.