<jupyter_start><jupyter_text>VIPatAINEAI  Virtual Internship Program by AINE.AI     Essential Python Programming  Project: Developing 'Rock,Paper and Scissors' game using Python Programming  Submitted By : <NAME>  About the Project * The project leverages the basic concepts of Python programming such as variables, data types, loop and conditional statements **to develop the game of Rock, Papers and Scissors.**  **Tool Used** : Python Jupyter Notebook  **Aim** : Write a Python program to develop a **Rock, Papers and Scissors game** to be played against a computer.  Objectives: 1. Getting familiar with the environment of the Jupyter Notebook on Anaconda 3.2. Using different types of cells – Code, Markdown and Heading,adding comments in the code cells.3. Understanding basic data types and lists in Python. 4. Working with lists and accessing its elements.5. Taking user inputs and printing them.6. Working on the random library.7. Creating loops.8. Using comparison operator to check the inputs.9. Conditional statements.10. Nested conditional statements in Python.11.	Break statement.12.	Concatenated print statements.  What is Rock Paper Scissors? * Rock paper scissors is a **hand game** usually played between **two people**, in which each player simultaneously forms one of three shapes with an outstretched hand.* These shapes are "rock" (a closed fist), "paper" (a flat hand), and "scissors" (a fist with the index finger and middle finger extended, forming a V).* **A simultaneous, zero-sum game**, it has only two possible outcomes: a draw, or a win for one player and a loss for the other.  What are the rules to the game 'Rock, Paper and Scissors'? * **Rock** crushes scissors.* **Paper** covers rock.* **Scissors** cut paper.  So, here I will be using above winning rules to develop simple 'rock,paper,scissors' game in python. * In this game, user gets the first chance to pick the possible actions.* After that computer will select from the choices randomly, then winner is decided as per the rules. **We have added two more elements in the game - Lizard and Spock. The game structure looks like:** __New derived rules:__* **Rock** crushes lizard.* **Paper** disproves spock.* **Scissors** decapitates lizard.* **Lizard** eats paper.* **Spock** smashes scissors.* **Lizard** poisons spock.* **Spock** vaporizes rock.  Import Necessary Libraries  The following code written in Python 3.x. Libraries provide pre-written functionally to perform necessary tasks.<jupyter_code>import random<jupyter_output><empty_output><jupyter_text>* The **random module** is a built-in module to generate the pseudo-random variables. * It can be used perform some action randomly such as to get a random number, selecting a random elements from a list, shuffle elements randomly, etc.   Using While loop<jupyter_code># Rock defeats scissor, lizard
# Paper defeats rock, spock
# Scissor defeats paper, lizard
# Lizard defeats spock, paper
# Spock defeats rock , scissors

moves = ['rock','paper','scissors','lizard', 'spock'] # possible actions in Rock,Paper & Scissor Game

# Victory Status
status_1 = 'Hurray !!!  \U0001F389 \U0001F389 \U0001F389  User Wins " \U0001F9D1 \U0001F469 \U0001F44D" \n ' 
status_2 = 'Hurray !!!  \U0001F389 \U0001F389 \U0001F389  Computer Wins " \U0001F916 \U0001F44D" \n'


# Line Separator
fight = ("\U00002694" * 50)


# excecute while loop as long as condition is true
game = True

# Use while loop to play several games in row
while game:
    u = input('Select Moves; {}   User Turn  \U0001F9D1 \U0001F469 :  '. format(moves))# taking input from the user
    if u != u.lower():
        break
  
    m = input('Enter a Move; {} \U0001F916  :  '.format(moves[random.randint(0,4)])) # making computer to choose randomly
    
    if u == m:
        print('Boo!! Tiee !! Nobody Wins \U0001F635 \n') # creating nested conditional statements to determine winner
      
        
    elif u == 'rock':
        if m == 'scissors':     # = is an assignment operator while == is for comparison
            print(status_1)   
        
        elif m == 'lizard':
            print(status_1)
            
        else:
            print(status_2)
    
    elif u == 'paper':
        if m == 'rock':
            print(status_1)
        
        elif m == 'spock':
            print(status_1)
            
        else:
            print(status_2)
    
    
    elif u == 'scissors':
        if m == 'paper':                
            print(status_1)
        
        elif m == 'lizard':
            print(status_1)
        
        else:
            print(status_2)
        
    elif u == 'lizard':
        if m == 'spock':
            print(status_1)
        
        elif m == 'paper':
            print(status_1)
        
        else:
            print(status_2)
            
    elif u == 'spock':
        if m == 'rock':
            print(status_1)
        
        elif m == 'scissors':
            print(status_1)
        else:
            print(status_2)
            
    else:
        print(status_2)
        
    quit = input("Want to quit? (y/n): ") #asking player to quit or continue the game
    if quit.lower() == "y":
        break
print("Let's play again \U0001F603 \n")
print(fight)<jupyter_output>Select Moves; ['rock', 'paper', 'scissors', 'lizard', 'spock']   User Turn  🧑 👩 :  spock
Enter a Move; lizard 🤖  :  lizard
Hurray !!!  🎉 🎉 🎉  Computer Wins " 🤖 👍" 

Want to quit? (y/n): n
Select Moves; ['rock', 'paper', 'scissors', 'lizard', 'spock']   User Turn  🧑 👩 :  paper
Enter a Move; paper 🤖  :  paper
Boo!! Tiee !! Nobody Wins 😵 

Want to quit? (y/n): n
Select Moves; ['rock', 'paper', 'scissors', 'lizard', 'spock']   User Turn  🧑 👩 :  scissors
Enter a Move; lizard 🤖  :  lizard
Hurray !!!  🎉 🎉 🎉  User Wins " 🧑 👩 👍" 
 
Want to quit? (y/n): n
Select Moves; ['rock', 'paper', 'scissors', 'lizard', 'spock']   User Turn  🧑 👩 :  rock
Enter a Move; rock 🤖  :  rock
Boo!! Tiee !! Nobody Wins 😵 

Want to quit? (y/n): y
Let's play again 😃 

⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔⚔<jupyter_text>1. In the beginning, we have created list by placing the elements inside the square [] brackets.2. Why we are taking user input is to ask user what they would like to select as an action.3. random.randint() is allowing computer to choose random action from the given list.4. The **randint()** method returns an integer number selected element from the specified range.5. Furthermore, when both player made their choices using a nested conditional statement i.e. **if..elif..else** ,we have compared their selection and determined a winner.6. In conclusion, to play the game several times we have placed nested conditional statements inside **while loop**.7. With the while loop, we can execute a set of statements as long as condition is **true**.8. It is important to check if user wants to continue the game or quit, without that user would be forced to play indefinitely so with the **break statement** we can stop the loop even if the while condition is true.9. **lower()** is a built-in Python method primarily used for string handling.10. It is used to check whether program does not show input invalid only considering lowercase.  Using For loop<jupyter_code>moves = ['rock','paper','scissors'] # possible actions in 'rock,paper,scissors' game


# Asking User for No.of rounds to play with Computer
n = int(input('Enter a No. of Rounds "\U0001F9D1 \U0001F469" \U00002694 "\U0001F916" :   '))


# Given Rules will decide the Winner
str_1 = 'PAPER COVERS ROCK \n'
str_2 = 'SCISSORS CUT PAPER \n'
str_3 = 'ROCK CRUSHES SCISSORS \n'

# Victory Status
status_1 = 'Hurray !!!  \U0001F389 \U0001F389 \U0001F389  User Wins " \U0001F9D1 \U0001F469 \U0001F44D" \n' 
status_2 = 'Hurray !!!  \U0001F389 \U0001F389 \U0001F389  Computer Wins " \U0001F916 \U0001F44D" \n'



# Line Separator
fight = ("-" * 100)

# Use for loop 
for i in range(1,n+1):
    user = input('Select Moves; {} \U0001F9D1 \U0001F469 :  '.format(moves)) # taking input from the user
    if user != user.lower():
        break
    
    machine = input('Enter a Move; {} \U0001F916  :  '.format(random.choices(moves))) #making computer to select randomly

    
    
    if user == machine:
        print('Boo!! Tiee !! Nobody Wins \U0001F635 \n')
        print(fight)
    
    elif user == 'paper':
        if machine == 'rock':
            print ('  '.join([str_1 ,status_1])) # string concatenation
            print(fight)
      
        elif machine == 'scissors':
            print('  '.join([str_2,status_2])) 
            print(fight)
        
        else:
            print()
    
    elif user == 'rock':
        if machine == 'paper':
            print ('  '.join([str_1 ,status_2]))
            print(fight)
        
        elif machine == 'scissors':
            print('  '.join([str_3,status_1]))
            print(fight)
    
    elif user == 'scissors':
        if machine == 'rock':
            print ('  '.join([str_3 ,status_2]))
            print(fight)
        
        elif machine == 'paper':
            print('  '.join([str_2,status_1]))
            print(fight)
        
        else:
            print()
    
    else:
        print('Enter a correct word')<jupyter_output>Enter a No. of Rounds "🧑 👩" ⚔ "🤖" :   3
Select Moves; ['rock', 'paper', 'scissors'] 🧑 👩 :  paper
Enter a Move; ['scissors'] 🤖  :  scissors
SCISSORS CUT PAPER 
  Hurray !!!  🎉 🎉 🎉  Computer Wins " 🤖 👍" 

----------------------------------------------------------------------------------------------------
Select Moves; ['rock', 'paper', 'scissors'] 🧑 👩 :  rock
Enter a Move; ['scissors'] 🤖  :  scissors
ROCK CRUSHES SCISSORS 
  Hurray !!!  🎉 🎉 🎉  User Wins " 🧑 👩 👍" 

----------------------------------------------------------------------------------------------------
Select Moves; ['rock', 'paper', 'scissors'] 🧑 👩 :  scissors
Enter a Move; ['rock'] 🤖  :  rock
ROCK CRUSHES SCISSORS 
  Hurray !!!  🎉 🎉 🎉  Computer Wins " 🤖 👍" 

----------------------------------------------------------------------------------------------------
{'fraction_non_alphanumeric': 0.14289982075283808, 'fraction_numerical': 0.03166699860585541, 'mean_word_length': 2.5041870202372647, 'pattern_counts': {'":': 1, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '344405', 'license': 'Apache-2.0', 'n_tokens_mistral': 3517, 'n_tokens_neox': 3170, 'n_words': 1189, 'path': 'Project 2/Project Essential Python Programming.ipynb', 'repo_name': 'ManjiriSDS/VIPAineAI', 'size': '10064'}