Skip to main content

Stone-Paper-Scissor in PYTHON

import random
import time
mylist = [1, 2, 3]
print("Welcome to the Stone-Paper-Scissor game.")

print("\nHere are some of the rules")
print("1.) There will be five round. The one whose score is more will be declared as winner.")
print("1.) For Stone, simply press 1.")
print("2.) For Paper, simply press 2.")
print("3.) For Scissor, simply press 3.")

print("\nNow, Lets go!")

i = 0
j = 0
k = 1
for k in range(1, 6):

    print("\nROUND ", k)
    y = int(input("\nEnter your choice as 1, 2 and 3 as instructed above: "))
    m = random.choice(mylist)

    if y==1:
        if m==1:
            print("\nTie")
        elif m==2:
            print("\nComputer chose paper, so you lose. Try again.")
            j = j+1
        elif m==3:
            print("\nYou win!")
            i = i+1
   
    elif y==2:
        if m==2:
            print("\nTie")
        elif m==1:
            print("\nComputer chose stone, so you lose. Try again.")
            j = j+1
        elif m==3:
            print("\nYou win!")
            i = i+1

    elif y ==3:
        if m==3:
            print("\nTie")
        elif m==2:
            print("\nComputer chose stone, so you lose. Try again.")
            j = j+1
        elif m==1:
            print("\nYou win!")
            i = i+1

    print("SCORECARD")
    print("Your score is: ", i)
    print("Apponent's score is: ", j)
   
    if i>j:
        print("\nYou are in a lead with", i-j, "scorepoints.")
    elif i==j:
        print("\nYou both have same score.")
    elif i<j:
        print("\nComputer is leading with", j-i, "scorepoints.")
    print("*********************************************************************************************")
    k = k+1

print("..............................................................................................")  
if i>j:
        print("\nYOU WON THE SERIES!")
elif i==j:
        print("\nYou both have same score. Can't decide the winner.")
elif i<j:
        print("\nComputer won! Try again.")

print("\n")
time.sleep(60)




John Veer
Contact mail id - john.veer.utube@gmail.com

Comments

Popular posts from this blog

Password Generator in PYTHON

Password Generator in Python:- import string import random import time s1 = string.ascii_lowercase s2 = string.ascii_uppercase s3 = string.digits s4 = string.punctuation password_length = input("Enter the length of password you want = ") password_length = int(password_length) password_list = [] a = input("Do you want lowercase letters in your password? (y/n): ") if a is "y": password_list.extend(s1) else: pass b = input("Do you want uppercase letters in your password? (y/n): ") if b is "y": password_list.extend(s2) else: pass c = input("Do you want numbers in your password? (y/n):") if c is "y": password_list.extend(s3) else: pass d = input("Do you want punctuations in your password? (y/n): ") if d is "y": password_list.extend(s4) else: pass random.shuffle(password_list) print("Generating the strongest password...") time.sleep(3) print("\n...

Binary to Decimal and Decimal to Binary Convertor in PYTHON

Binary to Decimal Convertor  Decimal to Binary Convertor in PYTHON import math while True: decision = input("\n \nPress 1 for decimal to binary conversion\nPress 2 for binary to decimal conversion\n") if(decision=="1"): print("Instructions") print("1.) Only positive numbers") print("2.) Number should not be in fraction") print("3.) It should not contains alphabets or other special characters") n = input("Enter the number: ") n = int(n) mylist = [] if n John Veer Basic Python Projects Contact mail id - john.veer.utube@gmail.com Thanks for reading www.basicpythonprogramme.blogspot.com www.basicpythonprojects.blosgpot.com 

Your Age in Seconds, Minutes, hours and in days program in PYTHON

  import datetime print ( " \n Instructions:" ) print ( " \n 1.) Put the date correctly." ) pyear = datetime . datetime . today (). strftime ( '%Y' ) pyear = int ( pyear ) pmonth = datetime . datetime . today (). strftime ( '%m' ) pmonth = int ( pmonth ) pdate = datetime . datetime . today (). strftime ( ' %d ' ) pdate = int ( pdate ) phour = datetime . datetime . today (). strftime ( '%H' ) phour = int ( phour ) pmin = datetime . datetime . today (). strftime ( '%M' ) pmin   = int ( pmin ) psec = datetime . datetime . today (). strftime ( '%S' ) psec = int ( psec ) byear = int ( input ( "Birth year (For eg. 2005, 1976 etc): " )) i = 1 while i > 0 :     if byear >= pyear :         print ( " \n Year is invalid.." )         byear = int ( input ( "Birth year (For eg. 2005, 1976 etc): " ))         i = i + 1     else :         break bmon...