Saturday 4 December 2021

Rock Paper Scissors Python Games | Games in Python

 Rock Paper Scissors Python Games | Games in Python


Rock , Paper , Scissors

import random
def play():
    print("Enter your choice:\n")
    user=input("'r' for rock\n's' for scissors\n'p' for paper\n\n")
    computer=random.choice(['r','p','s'])
    if user==computer:
         print("It is a tie...")
    elif user=='r' and computer=='s' or user=='s' and computer=='p' or user=='p' and computer=='r':
         print("You Won!!")
    else:
        print("Oh! You Lost! ")


    print(f"Oponent choice is : {computer} \n")
    print(f"Your choice is : {user}\n")
print(play())    

RockPaperScissors Game

Game in Python



No comments:

Post a Comment

Recent Post

Python Project | Banking System | Project on Banking System using python

  PYTHON PROJECT Banking System import csv import pandas as pd import matplotlib.pyplot as plt import sys import datetime found=False def ne...