BYU logo Computer Science

To start this assignment, download this zip file.

The following guide pages cover material needed for this assignment:

Project 3 - Youth Baseball

For this project, you need to write a program that registers players for baseball teams in a youth league. There are two teams:

  • Bigs — players over 10 years old
  • Littles — players 10 years and younger

The program should allow you to enter all the players and their ages, then print out a report on the two teams.

Registration

The registration program needs two things to register a player:

  • name
  • age

The program should automatically assign players to the two teams based on their age.

Report

For each team, the program prints:

  • Total members
  • Average age (rounded to zero decimal places)
  • Youngest age
  • Oldest age
  • Members (in a bulleted list)

Sample Input/Output

Here is some sample input and output:

Enter player name: Willie Mays
Enter player age: 10
Enter player name: Mike Trout
Enter player age: 4
Enter player name: Cat Osterman
Enter player age: 13
Enter player name: Jocelyn Alo
Enter player age: 15
Enter player name: Mike Trout
Enter player age: 8
Enter player name: Ted Williams
Enter player age: 9
Enter player name: Dot Richardson
Enter player age: 6
Enter player name: 
Team Bigs
Total members: 2
Average age: 14
Youngest age: 13
Oldest age: 15
Members
 - Cat Osterman 13
 - Jocelyn Alo 15
Team Littles
Total members: 5
Average age: 7
Youngest age: 4
Oldest age: 10
Members
 - Willie Mays 10
 - Mike Trout 4
 - Mike Trout 8
 - Ted Williams 9
 - Dot Richardson 6

Sample Code

You can find sample code in youth_baseball.py.

Testing

  1. You should test your program on your own before you run the tests we provide.

  2. When you are ready to submit, use Gradescope. The grader has been setup to award partial credit. The points awarded are shown below. In addition, each section has partial credit. For example, if you are missing only a space in your output, you will get most of the credit.

Manual Grading

Refer to the Quality Code guide page for detailed explanations and examples on each of these rubric criteria.

Intent The intent of this project is for you to write generic functions to process lists of tuples.

Avoid creating multiple functions that perform the same task. Instead, aim to have a single, generic function that can handle similar operations. For example, do not create two functions find_bigs_oldest(bigs) and find_littles_oldest(littles) that find the oldest team member of a list. Instead, create one generic function find_oldest(team). This will avoid duplicate code.

RubricPoints
Whitespace5
Naming5
Decomposition20
Intent20
Total50

Grading

ActivityPoints
Reading in the players5 (for each team)
Total members5 (for each team)
Average age10 (for each team)
Youngest age10 (for each team)
Oldest age10 (for each team)
Member list10 (for each team)
TA Grading50
Total150 points