Mini Project
Mini Project
By
Prajwal date
chandu
project name
Rock paper scissor(a player with a robot)
Steps;
Algarithom
Flow chart
code
explanation
>>Display Choices:*
- Print "1. Rock, 2. Scissors, 3. Paper".
>>User Input:*
- If the input is invalid, prompt the user again until a valid input is received.
- Map the user input number to its corresponding choice (1 to 'Rock', 2 to 'Scissors', 3 to 'Paper').
- If the choices are the same, regenerate the device's choice until they differ.
- Map the device's choice number to its corresponding choice (1 to 'Rock', 2 to 'Scissors', 3 to 'Paper').
- Compare the user’s choice and the device’s choice to determine the winner:
- If the user's choice matches the winning result, print "User Wins the game!!!".
- If the user inputs 'n' or 'N', break the loop and end the game.
Flow chart
Start
/\
No Yes
| |
v v
/\
No Yes
| |
v v
/\
Yes No
| |
v v
Display Display
/\
Yes No
| |
v v
code
import random
while True:
if user_input == 1:
user_input_choice = 'Rock'
user_input_choice = 'Scissors'
else:
user_input_choice = 'Paper'
print("User has selected:- " , user_input_choice)
device_choice = random.randint(1, 3)
if device_choice == 1:
device_input_choice = 'Rock'
device_input_choice = 'Scissors'
else:
device_input_choice = 'Paper'
result = 'Rock'
result = 'Paper'
else:
if user_input_choice == result:
else:
print("\n")
rematch = input()
break