Puffin length
A puffin
Download a file with data on the length of puffins. Here are the first few records:
- "Name","Length"
- "Roderick",26
- "Junie",24.8
- "Bea",29
- "Rodney",26
The minimum puffin length is 24 cm. Values below that are invalid. Values above 50 cm are invalid, too.
Most puffins are between 24 cm and 34 cm in length. Puffins lengths larger than 34 cm are mutants, possibly with superpowers. For example, the infamous super-villain The Dart was a mutant puffin. She sank 18 ships in the Atlantic before being taken out by Seal Team 3.
Seal Team 3
Write a program that computes statistics for regular and mutant puffins. Use the statistics
module, and at least two functions (I used three).
Here's what the report should look like:
- Puffin Lengths
- ====== =======
- Normals: no super powers
- Count: 41
- Mean: 29.01
- Standard deviation: 3.14
- Mutants: might have super powers
- Count: 3
- Mean: 38.23
- Standard deviation: 0.75
- - CUT SCREEN HERE - -
At one point, I put the wrong version of the data file in this exercise. Here's the output from that. Either one will count as correct.
- Puffin Lengths
- ====== =======
- Normals: no superpowers
- Count: 37
- Mean: 28.93
- Standard deviation: 3.29
- Mutants: might have superpowers
- Count: 7
- Mean: 38.16
- Standard deviation: 1.34
- Urgent! Send this report to Seal Team 3
- - CUT SCREEN HERE - -
Round to two decimal places.
Show the Seal Team 3 warning if there are more than five mutants.
Upload a zip of your project folder. The usual coding standards apply.
Goats Just Want to Have Jokes
Molly runs the comedy club, Goats Just Want to Have Jokes. For every comedian's set, she counts the number of hecklers, and the highest laugh volume, in dB. Write a program to work out some statistics for Molly.
Download the data file. Here's some of the data:
- "Performer","Hecklers","Highest laugh dB"
- "Aisha",5,113
- "Andreas","a lot",100
- "August",3,101
- "Bertha",2,118
- "Bessie",3,"Laptop broken"
- "Boyd",5,115
- "Bridgette",-2,114
When Aisha performed, she had 5 hecklers, and the loudest laugh was 113dB.
Valid records must have names. Can't be MT.
Valid heckler and volume input must be non-negative numbers.
Write a program that outputs stats like this:
- Goats Just Want to Have Jokes
- ===== ==== ==== == ==== =====
- Counts
- - - -
- Valid records: 46
- Invalid records: 4
- Total records: 50
- Hecklers
- - - - -
- Mean: 3.67
- Std dev: 2.07
- Smallest: 0 Dawn
- Largest: 7 Johnnie
- Sound
- - - -
- Mean: 101.3
- Std dev: 11.36
- Smallest: 81 Heather
- Largest: 125 Herman
- Correlation (hecklers, sound dB): -0.3
Use the statistics
module. Use at least three functions (I had more in my solution).
Upload a zip of your project folder. The usual coding standards apply.
Grades and starting salaries
This was from ye olde web on December 7, 2024.
- - CUT SCREEN HERE - -
The average salary for an entry-level Python developer in the United States is around $80,625 per year, or $68.10 per hour.
Salary
The average salary for an entry-level Python developer is $80,625 per year, which is up from $73,551 in 2023.
Hourly rate
The average hourly pay for an entry-level Python programmer is $68.10, with a range of $40.62–$82.93.
Additional pay
The estimated additional pay for an entry-level Python developer is $17,260 per year, which could include cash bonuses, commissions, tips, and profit sharing.
Here are some other Python developer salaries:
- Mid-level: $127,363 per year
- Senior: $201,196 per year
- Top earners: $188,507 per year
- - CUT SCREEN HERE - -
Write a program to compute statistics for the relationship between grades in a Python course and starting salary. Use this data file. (I made up the raw data, based on the stats above.)
Here's some data from the file:
- Python grade,Starting salary
- 2.5,74222
- 3.3,88878
- 3.1,84680
- 3.2,83757
- 2.4,64016
The first field is a student's grade in a Python course. The second is their starting salary.
Rules for valid data:
- Grades are floats that cannot be less than 0 or greater than 4.
- Salaries are integers that cannot be less than 0 or greater than 400,000.
Only analyze data from valid records. As usual, all fields in a record must be valid for the record to be considered valid.
Here's the program's output with the data set given, showing the type of data your program should produce:
- Grades and starting salaries for Python programmers
- ===================================================
- Number of records: 49
- Number of valid records: 45
- Mean grade: 3.14
- Mean starting salary: 87590
- Correlation: 0.96
Of course, your program should be able to work with any compatible data set.
Round values as shown. Two decimal places for mean grade, zero for mean salary, and two for correlation.
Use functions. My solution had six, but you can have more or fewer. Include docstrings for every function.
My main program was 17 lines without comments. Ten lines were output, so the guts of the main program was just seven lines. Almost all of the program's code was in functions.
Upload your solution here, not to Moodle. The usual programming standards apply.
Pokemon EXP
This data is modified from a Kaggle data set.
The data set has records with three fields. Here is part of the CSV file:
- "trainer","number_pokemon","total_EXP"
- "Youngster Tristan",1,60
- "Youngster Logan",1,65
- "Lass Natalie",1,62
- "Youngster Michael",2,150
- "Camper",1,61
Fields:
- Trainer name. Validation rule: cannot be MT (empty).
- Number of Pokémon. Validation rule: an integer from 0 to 6.
- EXP. Validation rule: an integer from 0 to 50,000.
Write a program to validate the data, and show means and counts comparing trainers with few Pokémon (0 to 3) to those with many (4 to 6). Here is my output:
- Pokemon Trainers Exp Points
- ======= ======== === ======
- Valid records: 919
- Invalid records: 8
- Total records: 927
- Low pokemon count (0-2)
- - - - - - - - - - - - -
- Records: 697
- Mean: 1653.22
- High pokemon count (3-6)
- - - - - - - - - - - - -
- Records: 222
- Mean: 4097.98
Use line spacing and underlining as shown.
Add docstrings to every function.
Round means to two decimal places.
Upload your solution to this website as usual, not to Moodle.
The usual programming standards apply.