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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started