View Single Post
Old 07-21-2014, 01:24 PM   #8
GoldenEagle
Grizzled Veteran
 
Join Date: Dec 2002
Location: Little Rock, AR
Quote:
Originally Posted by SirBlurton View Post
Just wanted to chime in and say I'll be watching with great interest....a little embarrassed that you've seemingly done in one day what's taken me years to learn!

I am an absolute beginner in python, so take this with a grain of salt - but what I've done in some of my tinkering has been to collect players in a list (ie-homeTeam contains all of the player objects for the home team).

Just makes it a bit cleaner when managing the function call.
For example:
def TopJumper(homeTeam,awayTeam)...

You could then loop through those lists to find the players with the best jumping ability.

Anyway, very cool to see this on the forum! Good luck!

I haven't looked at Python in quite awhile and I just scanned through the problem but there is almost certainly a faster way to do this. Off the top of my head, you can just call a sort method on the list.

Remember that anytime you use a data structure, someone has already gone through the work of thinking about the fastest way to do things via algorithms.

But your suggestion is excellent to make the code more compact, which is critical for maintaining the code. A good philosophy to remember is DRY. Don't repeat yourself. Anytime you find yourself basically copying and pasting in programming, there is a better way to do it.

Anyways, cool thread. I will try to remember to follow long.
__________________
Xbox 360 Gamer Tag: GoldenEagle014
GoldenEagle is offline   Reply With Quote