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 Object-Oriented Python (retired) Inheritance Score Method

Pere Martra
Pere Martra
9,967 Points

Help in Challenge Object-Oriented Python. :-(

Hi, I think that i don't understand what I need to do

Tha'ts my code:

class Game:
  def __init__(self):
    self.current_score = [0, 0]
  def score(player):
    player.current_score[0] += 1
    player.current_score[1] += 1

The main problem is I know that it works, but i have no idea is this what I need to do :-p You are asking to increase in 1 the current_score, but current_score is a tuple with 2 values in...

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Right, I want you to increase the player I give you's score by 1. So if I say 1, you'd increase Player 1's score (self.current_score[0] += 1).

How do you think I could make the instruction more clear?

2 Answers

Pere Martra
Pere Martra
9,967 Points

Ok....

solved looking at the forums :-)

def score(self, player): self.current_score[player - 1] += 1

Thanks!!!!

Pere Martra
Pere Martra
9,967 Points

Hi kenneth

The main problem Is my English :-) and that I didn't remember that we have 2 players in the first Challenge.

Maybe indicate that the first position in the tuple is for player one, and second for player two.

Thanks for your answer! I'm really enjoying your courses.

Just a question, I'm using python in the appengine by google. Do you, or treehouse, have any plans to cover appengine in the future?

By the way, I'm really expecting for more advanced python courses, maybe using DB's. :-)

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

I'll add some comments about the player positions the next time I'm updating that challenge.

As for your questions, I don't think we'll cover GAE since it's often a really weird version of Python. If you're building something that works with GAE, GAE works great, but when you want to think outside of the GAE box, it often causes way more problems than it's worth.

We'll be covering Python with databases before too much longer, I promise!