logo

Rock, Paper, Scissors

100 Days of Code: The Complete Python Pro Bootcamp Day 4.


My code:


                        import asciII
                        import random
                        
                        welcome = input("Choose Rock (r), Paper (p), or Scissors (s): ")
                        welcome_low = welcome.lower()
                        
                        npc = random.randint(1, 3)
                        
                        # Rock
                        if (welcome_low == "rock" or welcome_low == "r") and npc == 1:
                            print(f"You chose: {asciII.rock}. NPC chose: {asciII.rock}. Result: It's a draw!")
                        elif (welcome_low == "rock" or welcome_low == "r") and npc == 2:
                            print(f"You chose: {asciII.rock}. NPC chose: {asciII.paper}. Result: You lose!")
                        elif (welcome_low == "rock" or welcome_low == "r") and npc == 3:
                            print(f"You chose: {asciII.rock}. NPC chose: {asciII.scissors}. Result: You win!")
                        
                        # Paper
                        elif (welcome_low == "paper" or welcome_low == "p") and npc == 1:
                            print(f"You chose: {asciII.paper}. NPC chose: {asciII.rock}. Result: You win!")
                        elif (welcome_low == "paper" or welcome_low == "p") and npc == 2:
                            print(f"You chose: {asciII.paper}. NPC chose: {asciII.paper}. Result: It's a draw!")
                        elif (welcome_low == "paper" or welcome_low == "p") and npc == 3:
                            print(f"You chose: {asciII.paper}. NPC chose: {asciII.scissors}. Result: You lose!")
                        
                        # Scissors
                        elif (welcome_low == "scissors" or welcome_low == "s") and npc == 1:
                            print(f"You chose: {asciII.scissors}. NPC chose: {asciII.rock}. Result: You lose!")
                        elif (welcome_low == "scissors" or welcome_low == "s") and npc == 2:
                            print(f"You chose: {asciII.scissors}. NPC chose: {asciII.paper}. Result: You win!")
                        elif (welcome_low == "scissors" or welcome_low == "s") and npc == 3:
                            print(f"You chose: {asciII.scissors}. NPC chose: {asciII.scissors}. Result: It's a draw!")
                        
                    

And here are all ASCI II art I used for this little game.


                        rock = """
                        _______
                    ---'   ____)
                          (_____)
                          (_____)
                          (____)
                    ---.__(___)
                    """
                    
                    paper = """
                        _______
                    ---'   ____)____
                              ______)
                              _______)
                             _______)
                    ---.__________)
                    """
                    
                    scissors = """
                        _______
                    ---'   ____)____
                              ______)
                           __________)
                          (____)
                    ---.__(___)
                    """