Problem 164452 · easy · Phase 01 Prerequisites & Setup

Rock-Paper-Scissors Tally

loops · conditionals · lists

Two players played several rounds of rock-paper-scissors. p1 and p2 are lists of equal length holding each player's move per round ("rock", "paper" or "scissors"). Rock beats scissors, scissors beats paper, paper beats rock; identical moves are a tie. Return [p1_wins, p2_wins, ties].

Examples

Input:  p1 = ["rock", "paper", "scissors"], p2 = ["scissors", "paper", "rock"]
Output: [1, 1, 1]

Input:  p1 = ["paper", "paper"], p2 = ["rock", "scissors"]
Output: [1, 1, 0]

Constraints

  • 0 <= len(p1) == len(p2) <= 1000

Goals

  • Walk two lists in step with a shared index
  • Encode the beats-relationship of a game in conditionals
Starting Python…