Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I had a hard time to understand this so i will try to explain for the poeple, who had a question like me.
results = ['Draw!', 'Player 1 won!', 'Player 2 won!']
the first item in the arrays has index [0], the second has index[0] etc but when its negative its go backwards like
'Player 2 won!' is [-1], 'Player 1 won!' is [-2] and finally 'Draw!' is [-3].
[-0] is same as [0]
string replace to str
thank you
this is helpful thank you
thank you!
wow - negative indexing v positive indexing - glad i asked glad you answered thank you!
Just use str.maketrans instead of string.maketrans in python 3.
Unfortunately, string.maketrans() is not in python 3. https://stackoverflow.com/questions/40770018/python-attributeerror-module-string-has-no-attribute-maketrans
yes. Python's negative indexing would then pick 'Player 1 won!' as it's the second last (-2) item in the array.
This comment is hidden because it contains spoiler information about the solution
super helpful thanks!
cool! did not remember to add +1, makes sense
why use mul instead of explicitly multiplying out?
doesn't work for me. is this python 2? if so how to write in python 3?
i do not understand this, would be amazing if someone explained.
return results[hand[p1] - hand[p2]]
if rock v scissors result would equal to -2 which would give me the -2 item in list?
Loading more items...