Saturday, May 28, 2022

Rock, Paper, and Scissors Game in Python

 A simple game program that I wrote using Python programming language called Rock, Paper, and Scissors I hope you will like it.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing

import random

name = input()
user_action = input("Enter a choice (rock, paper, scissors): ")
possible_actions = ["rock", "paper", "scissors"]
computer_action = random.choice(possible_actions)
print(f"\nYou chose {user_action}, computer chose {computer_action}.\n")

if user_action == computer_action:
print(f"Both players selected {user_action}. It's a tie!")
elif user_action == "rock":
if computer_action == "scissors":
print(f"Rock smashes {name}! You win!")
else:
print(f"Paper covers {name}! You lose.")
elif user_action == "paper":
if computer_action == "rock":
print(f"Paper covers {name}! You win!")
else:
print(f"Scissors cuts {name}! You lose.")
elif user_action == "scissors":
if computer_action == "paper":
print(f"Scissors cuts {name}! You win!")
else:
print(f"Rock smashes {name}! You lose.")

No comments:

Post a Comment