Rock, Paper and Scissor Game in Python | Python full tutorial

Описание к видео Rock, Paper and Scissor Game in Python | Python full tutorial

import random
print("Welcome ") #welcome message for user
options=("Rock","Paper","Scissor")#options
running=True
while running:
player1=None
player2=random.choice(options) #computer will choose one randon value from choices

while player1 not in options: # if not in option then it will print this

player1=input("Enter Rock,Paper or Scissor : ")#user will enter his chioce from options
print("Player 1 : " , player1)#print the chosen value of player one
print("Player 2 : " , player2)#print the chosen value of User
if player1 == player2:#it will tell who won this game
print("Its Tie!")
elif player1.lower()=="Rock" and player2=="Scissor":
print("You win!")
elif player1=="Paper" and player2=="Rock":
print("You win!")
elif player1=="Scissor" and player2=="Paper":
print("You win!")
else:
print("You lose!")
print("1. Enter 'Y' to Play Again ")#this is for if user want to play again
print("2. Enter any Alphabet except 'y' to Exit ") #If user want to exit
play_again=input("Do you want to play again? (Y/N) : ")#for user input
play_again=play_again.lower()
if not play_again=="y":# if user dont want to play again
running=False #loop will become false and program will end here

print(" Thanks For Playing " ) #if program will end it will print this





#PythonProgramming
#PythonTutorial
#LearnPython
#PythonProjects
#RockPaperScissors
#CodingForBeginners
#PythonCoding
#ProgrammingTutorial
#PythonGames
#CodingInPython
#PythonForBeginners
#PythonCode
#GameDevelopment
#PythonBasics
#BeginnerPython
#PythonScript
#FunWithPython
#PythonChallenge
#PythonLearning
#PythonExercise

Комментарии

Информация по комментариям в разработке