Search This Blog
Available Codings for Programming of C, C++, PYTHON, JAVA and HTML.
Welcome to Coding 4 Programming
- Get link
- X
- Other Apps
Labels
Stone / Rock Paper Scissor Game | Snake Water Gun Game | Random Function| Import | Python
Python Program or Project of Stone / Rock, Paper, Scissor (you can also modify it into Snake, Water, Gun Game) through Function, and using Module through Import and using Random Function, completely user Friendly without any type of Errors.
- Coding for the above Program.
- import random
- def winner():
- win=True
- if c=="r":
- if p=="p":
- return win
- else:
- win=False
- return win
- elif c=="p":
- if p=="s":
- return win
- else:
- win=False
- return win
- else:
- if p=="r":
- return win
- else:
- win=False
- return win
- print("Welcome to Stone Paper Scissor Game!")
- print("Press 'r' for Stone/Rock")
- print("Press 'p' for Paper")
- print("Press 's' for Scissor")
- p=input("Enter your choice=")
- if p not in["r","p","s"]:
- print("Wrong Input.")
- exit()
- c=random.choice(["r","p","s"])
- print("Computer Selected",c)
- if p==c:
- print("Game Draw")
- else:
- w=winner()
- if w:
- print("Congrats... You Won the Game")
- else:
- print("Oops! You Loose the Game")
- Output of the Temperature Conversion Program.
Stone Paper Scissor Game |
Notes:
- If you have any problem related to this program. Please do comment your Problem or Mail us.
- For illustrating the any concept you can comment by line number.
- Thank you! For more programs do regular visit to Coding 4 Programming.
- Get link
- X
- Other Apps
Labels:
Python
Popular Posts
To Check Prime Number | For Loop | Python
- Get link
- X
- Other Apps
To Check Perfect Number | Function | For Loop | Python
- Get link
- X
- Other Apps
Comments
Post a Comment