Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

Moises Miguel
Moises Miguel
5,028 Points

Can you guys help me work out the bugs in this project?

If i pick rock, paper or scissors the random_choice does not change. It keeps giving me back the same answer. How do i change that? also it does not record the wins, loses and draws

https://w.trhou.se/fxionyc191

1 Answer

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

Hi,

I just started myself so I'm not an expert at all, but I noticed something that might help:

I added continue after every wins, losses, draws because that might throw you back up to the start letting you choose another action + it should store the points (I hope). Also instead of calling the elif player == 'q' multiple places maybe try do something like this:

        if player == 'r':
            if random_choice == 'r':
                print('I chose {}, we tied'.format(random_choice))
                Draws += 1
                continue
            elif random_choice == 'p':
                print('I chose {}, You lose!'.format(random_choice))
                Loses +=1
                continue
            else:
                print('I chose {}, You win'.format(random_choice))
                Wins +=1
                continue
        elif player == 'p':
            if random_choice == 'r':
                print('I chose {}, You Win'.format(random_choice))
                Wins +=1
                continue
            elif random_choice == 'p':
                print('I chose {}, We tied'.format(random_choice))
                Draws += 1
                continue
            else :
                print('I chose {}, You lose'.format(random_choice))
                Loses +=1
                continue
        elif player == 's':
            if random_choice == 'r':
                print('I chose {}, You lose'.format(random_choice))
                Loses +=1
                continue
            elif random_choice == 'p':
                print('I chose {}, You win!'.format(random_choice))
                Wins +=1
                continue
            else:
                print('I chose {}, We tied'.format(random_choice))
                Draws += 1
                continue
        elif player == 'q':
            break

print('Wins: {}, Loses: {}, Draws {}'.format(Wins, Loses, Draws))

Please let me know if it helped or not :-)