A simple program paper,scissors, and rocks game that I wrote using Python programming language.
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 at 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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
# Mr. Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.com www.jakerpomperada.blogspot.com
# jakerpomperada@gmail.com
# February 23, 2021
# Bacolod City, Negros Occidental
print()
print("\tPaper,Scissors, and Rocks Game in Python");
print()
p1 = str(input("Player1: "))
p2 = str(input("Player2: "))
if (p1.lower() =='p') and (p2.lower() =='r'):
print("Player 1 wins! Paper covers rock!")
elif (p2.lower() == 'p') and (p1.lower() == 'r'):
print("Player 2 wins! Paper covers rock!")
elif (p1.lower() == 's') and (p2.lower() == 'p'):
print("Player 1 wins! Scissors cuts paper!")
elif (p2.lower() == 's') and (p1.lower() == 'p'):
print("Player 2 wins! Scissors cuts paper!")
elif (p1.lower()=='r') and (p2.lower()=='s'):
print("Player 1 wins!. Rock breaks scissors")
elif (p2.lower()=='r') and (p1.lower()=='s'):
print("Player 2 wins!. Rock breaks scissors")
elif (p1.lower()=='p') and ( p2.lower()=='p'):
print("Draw!")
elif (p1.lower()=='r') and (p2.lower()=='r'):
print("Draw!")
elif (p1.lower() == 's') and (p2.lower() == 's'):
print("Draw!")
else:
if (p1.lower()!= 'p' or p1.lower() !='r' or p1.lower()!='s') \
and ( p2.lower()=='p' or p2.lower() == 'r' or p2.lower()=='s'):
print(f"Player 1 entered an invalid value \"{p1}\" ")
elif (p2.lower()!= 'p' or p2.lower()!='r' or p2.lower() !='s') \
and (p1.lower()=='p' or p1.lower() == 'r' or p1.lower() =='s'):
print(f"Player 2 entered an invalid value \"{p2}\" ")
else:
print(f"Player 1 entered an invalid value \"{p1}\" ")
print(f"Player 2 entered an invalid value \"{p2}\" ")
print()
print("\tEND OF PROGRAM");
print()
No comments:
Post a Comment