HAND CRICKET Program in Python

 

 HAND CRICKET Program in Python



Program:

# Program developed by ARUN
# © Copyrights owned by DATA DEMONS
print("********HELLO*********")
from random import randint as rdnt
from time import sleep as sp
print("Rules :-")
sp(0.5)
print("1) Your input should be in (0,1,2,3,4,5,6,7,8,9,10).")
sp(0.5)
print("2) Computer's output will be genuine.")
sp(0.5)
print("3) No empty Enters.")
sp(0.5)
print("4) Spellings and numbers should be entered correct.")
sp(0.5)
print("5) No results will be shown if you had broken the rules")
sp(0.5)
print("6) No Trials")
sp(0.5)
Toss = input("Even / Odd : ")
sp(0.5)
int1 = int(input("Your Number : "))
T = ''
if int1 >= 0 and int1 <=10:
    T = 'Y'
    int2 = rdnt(0, 10)
    print("Computer's Number : ", int2)
    sp(0.5)
    if (int2 + int1) % 2 == 0 and Toss.lower() == 'even':
        print("It's an even")
        sp(0.5)
        print("Choice is yours")
        sp(0.5)
        Choice = input("Batting / Bowling")
    elif (int2 + int1) % 2 != 0 and Toss.lower() == 'odd':
        print("It's an odd")
        sp(0.5)
        print("Choice is yours")
        sp(0.5)
        Choice = input("Batting / Bowling")
    elif (int2 + int1) % 2 != 0 and Toss.lower() == 'even':
        print("It's an odd")
        sp(0.5)
        print("Choice is mine")
        sp(0.5)
        print("I gonna bowl first")
        Choice = 'bowl'
    elif (int2 + int1) % 2 == 0 and Toss.lower() == 'odd':
        print("It's an even")
        sp(0.5)
        print("Choice is mine")
        sp(0.5)
        print("I gonna bowl first")
        Choice = 'bowl'
    if Choice.lower() == 'batting' or Choice.lower() == 'bowl':
        int3 = int(input("Your Number : "))
        if int3 >= 0 and int3 <= 10:
            T = 'Y'
            int4 = rdnt(0, 10)
            print("Computer's Number : ", int4)
            battingScore = 0
            while int3 != int4:
                if int3 == 0:
                    battingScore += int4
                else:
                    battingScore += int3 
                int3 = int(input("Your Number : "))
                if int3 >= 0 and int3 <=10:
                    T = 'Y'
                    int4 = rdnt(0, 10)
                    print("Computer's Number : ", int4)
                else:
                    print("Sorry play from first, read the rules properly you broke it")
                    break
            else:
                print("***     OUT     ***")
                print("Your score : ", battingScore)
        else:
            print("Sorry play from first, read the rules properly you broke it")
        print("Now batting is my turn")
        int11 = int(input("Your Number : "))
        if int11 >= 0 and int11 <= 10:
            T = "Y"
            int12 = rdnt(0, 10)
            print("Computer's Number : ", int12)
            bat = 0
            while int11 != int12:
                if int11 == 0:
                    bat += int11
                else:
                    bat += int12 
                int11 = int(input("Your Number : "))
                if int11 >= 0 and int11 <=10:
                    T = "Y"
                    int12 = rdnt(0, 10)
                    print("Computer's Number : ", int12)
                else:
                    print("Sorry play from first, read the rules properly you broke it")
                    break
            else:
                print("***     OUT     ***")
                print("My batting score : ", bat)
        else:
            print("Sorry play from first, read the rules properly you broke it")
    elif Choice.lower() == 'bowling':
        int6 = int(input("Your Number : "))
        if int6 >= 0 and int6 <= 10:
            T = "Y"
            int7 = rdnt(0, 10)
            print("Computer's Number : ", int7)
            bat = 0
            while int6 != int7:
                if int6 == 0:
                    bat += int6
                else:
                    bat += int7 
                int6 = int(input("Your Number : "))
                if int6 >= 0 and int6 <=10:
                    T = "Y"
                    int7 = rdnt(0, 10)
                    print("Computer's Number : ", int7)
                else:
                    print("Sorry play from first, read the rules properly you broke it")
                    break
            else:
                print("***     OUT     ***")
                print("My batting score : ", bat)
        else:
            print("Sorry play from first, read the rules properly you broke it")
        print("Now batting is your turn")
        int8 = int(input("Your Number : "))
        if int8 >= 0 and int8 <= 10:
            T = "Y"
            int9 = rdnt(0, 10)
            print("Computer's Number : ", int9)
            bat = 0
            while int8 != int9:
                if int8 == 0:
                    bat += int9
                else:
                    bat += int8 
                int9 = int(input("Your Number : "))
                if int8 >= 0 and int8 <=10:
                    T = "Y"
                    int9 = rdnt(0, 10)
                    print("Computer's Number : ", int9)
                else:
                    print("Sorry play from first, read the rules properly you broke it")
                    break
            else:
                print("***     OUT     ***")
                print("My batting score : ", bat)
        else:
            print("Sorry play from first, read the rules properly you broke it")
if T == "Y":
    print("MY SCORE \t YOUR SCORE")
    print(battingScore, '\t\t', bat)
    if battingScore > bat:
        print("You won the game")
    elif bat > battingScore:
        print("I won the game")
    elif bat == battingScore:
        print("Tie")

Programmer details : Arun Meyyappan PL
Software used: IDLE python
Version : 3.10.8

Documents and files download link

Python File(.py)


Text File(.txt)







0 Comments