Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Nguyen Duong
seal-mask
.a{fill-rule:evenodd;}techdegree
Nguyen Duong
Python Development Techdegree Student 3,071 Points

Unit 2 Baseball Stat Project of Python Techdegree

Hello! I am on Unit 2 Project of the Python Techdegree and it took me a long time to start figuring out how to go about it.

After cleaning the data as instructed, I managed to come up with something like this and have the three teams split evenly, with an equal amount of experienced and inexperienced players on each team.

My question is: Does this look right? I know it seems almost too basic or elementary, I'm not sure if there might be a more efficient way of doing it that's more complex. I just did what I could from scratch and this is the best I could come up with at the moment with my knowledge as of now.

If I am heading in the right direction the rest of the project I should be able to figure out. I just wanted feedback up until now to see if maybe I am missing something or if the way I arrived here is too rudimentary. :(

Thank you for your time and effort!

Snapshot of my code:

https://w.trhou.se/xetfeudejq

Jeff Muday
Jeff Muday
Treehouse Moderator 28,720 Points

The thing I love about Python (well for that matter, programming) is there are MANY ways to write a good project!

This is quite nice, so far, but you have some refactoring to do to complete the specifications for the assignment.

Disclaimer: I am just a moderator, so I don't know much about your Techdegree.

Comments (based on the specifications):

  1. Specification Pt 1-- Good. I like you included constants.py in your app.py. This demonstrates your understanding of "separation of concerns"
  2. Specification Pt 2-- The dunder main calling should be moved from constants.py to app.py
  3. Specification Pt 3-- A few comments about refactoring the app.py
  • clean_data() is pretty good. I can think of style hints, but this is good as is. You demonstrated encapsulation.
  • You're going to have to encapsulate the logic of separating the players into teams into a separate function e.g. one large function called allocate_teams(players_new) OR separate them into two functions separate_experience(new_players) and allocate_teams(experienced, inexperienced)
  • You will write main() to include calls to clean_data(), allocate_players(), print_players()

Keep going, you are doing great!

2 Answers