Question: Load data from the data file ps3_chicken_data.txt Data is formatted in pairs of x,y on each line, where x is the name of the chicken
Load data from the data file ps3_chicken_data.txt
Data is formatted in pairs of x,y on each line, where x is the name of the chicken and y is indicates the weight of how much the chicken eats. (e.g. Chuck,12) All unique.
Helpful functions: str.split, open, file.readline, file.close
Read the contents of the given file. Assumes the file contents contain data in the form of comma-separated chicken name, weight pairs, and return a dictionary containing cow names as keys and corresponding weights as values.
Parameters:
filename - the name of the data file as a string
Returns:
a dictionary of chicken name (string), weight (int) pairs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
