import random

def ask():
    while True:
        s = input('Let\'s play the game:\n\t1. Rock\n\t2. Paper\n\t3. Scissors?\nWhat you choose?: ')
        if s.isdigit():
            c = int(s)
            if not (1 <= c <= 3):
                print('Invalid input, please re-select again!')
                continue
        else:
            print('Invalid input, please re-select again!')
            continue
        return c

def ai():
    return random.randint(1, 3)

def compete(c, s):
    if s == c:
        print('HaHa, no one wins!')
    elif c == 1:
        if s == 2:
            print('I\'m Paper, I win!')
        else:
            print('I\'m Scissors, You win!')
    elif c == 2:
        if s == 1:
            print('I\'m Rock, You win!')
        else:
            print('I\'m Scissors, I win!')
    elif c == 3:
        if s == 1:
            print('I\'m Rock, I win!')
        else:
            print('I\'m Paper, You win!')

def another():
    while True:
        ans = input('Another round? y/n: ')
        if ans == 'y':
            return True
        elif ans == 'n':
            return False
        else:
            print('Invalid input, try again!')
            continue

if __name__ == '__main__':
    while True:
        c = ask()
        a = ai()
        compete(c, a)
        if not another():
            break


@@ -8,16 +8,113 @@
 random%0A%0A
+CHOICES = %7B1: 'Rock', 2: 'Paper', 3: 'Scissors'%7D%0ARESULTS = %5B%5B0, -1, 1%5D, %5B1, 0, -1%5D, %5B-1, 1, 0%5D%5D%0A%0A
 def ask(
@@ -583,21 +583,47 @@
 s):%0A
+    r = RESULTS%5Bc-1%5D%5Bs-1%5D%0A
     if 
-s
+r
  == 
-c
+0
 :%0A  
@@ -665,21 +665,22 @@
    elif 
-c
+r
  == 
+-
 1:%0A     
@@ -686,203 +686,76 @@
     
-if s == 2:%0A            print('I%5C'm Paper, I win!')%0A        else:%0A            print('I%5C'm Scissors, You win!')%0A    elif c == 2:%0A        if s == 1:%0A            print('I%5C'm Rock, You win!'
+print('You%5C're %25s, I%5C'm %25s, I win!' %25 (CHOICES%5Bc%5D, CHOICES%5Bs%5D)
 )%0A    
- 
-   
 else
@@ -768,172 +768,72 @@
     
-   
- 
 print('
-I%5C'm Scissors, I win!')%0A    elif c == 3:%0A        if s == 1:%0A            print('I%5C'm Rock, I win!')%0A        else:%0A            print('I%5C'm Paper, You win!'
+You%5C're %25s, I%5C'm %25s, You win!' %25 (CHOICES%5Bc%5D, CHOICES%5Bs%5D)
 )%0A%0Ad

Improve exercise 8