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

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 :-)