Support our Blind Hand Charity by donating at 9818291723. Your contribution has the potential to bring about significant positive change for humanity.

Search This Blog

Sunday, November 17, 2024

La Mea Khow Restaurannt

import mysql.connector as msc


mycon=msc.connect(host='localhost',user='root',passwd='edward',database='la_mea_khow')

cur=mycon.cursor()


def eat5(amt):

    if amt>499:

        return int(amt*0.95)


def food10(amt):

    if amt>1299:

        return int(amt*0.90)


def foodie(amt):

    if amt>1799:

        return int(amt*0.85)


while True:

    print("""

┌────────────────────────────────────────────────────────────────────────────┐

│                                  LA MEA KHOW                               │

│                                                                            │

│                               TABLE ARRANGEMENT                            │

│                                                                            │

│                ┌──┐ ┌──┐ ┌──┐                ┌──┐   ┌──┐                   │

│                │  │ │  │ │  │                │  │   │  │                   │

│                └┼┼┘ └┼┼┘ └┼┼┘                └┼┼┘   └┼┼┘                   │

│          ┌──┐ ┌────────────┐ ┌──┐     ┌──┐ ┌────────────┐ ┌──┐             │

│          │  │ │    [1]     │ │  │     │  │ │    [2]     │ │  │             │

│          └┼┼┘ └────────────┘ └┼┼┘     └┼┼┘ └────────────┘ └┼┼┘             │

│                ┌──┐ ┌──┐ ┌──┐                ┌──┐   ┌──┐                   │

│                │  │ │  │ │  │                │  │   │  │                   │

│                └┼┼┘ └┼┼┘ └┼┼┘                └┼┼┘   └┼┼┘                   │

│                                                                            │

│                ┌──┐ ┌──┐ ┌──┐                ┌──┐   ┌──┐                   │

│                │  │ │  │ │  │                │  │   │  │                   │

│                └┼┼┘ └┼┼┘ └┼┼┘                └┼┼┘   └┼┼┘                   │

│          ┌──┐ ┌────────────┐ ┌──┐     ┌──┐ ┌────────────┐ ┌──┐             │

│          │  │ │    [3]     │ │  │     │  │ │    [4]     │ │  │             │

│          └┼┼┘ └────────────┘ └┼┼┘     └┼┼┘ └────────────┘ └┼┼┘             │

│                ┌──┐ ┌──┐ ┌──┐                ┌──┐   ┌──┐                   │

│                │  │ │  │ │  │                │  │   │  │                   │

│                └┼┼┘ └┼┼┘ └┼┼┘                └┼┼┘   └┼┼┘                   │

│                                                                            │

│                              ┌────────────┐                                │

│                              │ [5]. EXIT  │                                │

│                              └────────────┘                                │

└────────────────────────────────────────────────────────────────────────────┘""")

    tb=int(input("Enter the table no. = "))

    if tb==5:

        break

    elif tb in [1,2,3,4]:

        tbn=tb

    else:

        print("Invalid Operation number entered")

    while True:

        print("""

┌────────────────────────────────────────┐

│                Welcome                 │

│                   To                   │

│              LA MEA KHOW               │

│                                        │

│             [1]. MENU                  │

│             [2]. ORDER                 │

│             [3]. PAY BILL              │

│             [4]. BACK                  │

└────────────────────────────────────────┘""")

        o=int(input("Enter the operation number = "))

        if o==4:

            break

        elif o==1:

            cur.execute("select * from menu;")

            me=cur.fetchall()

            s=0

            print("\t\tVEG")

            for i in me:

                if i[1]=='veg':

                    s+=1

                    print(s,end=' ')

                    print(i[2].title(),':',i[3])

                    print("MRP :",i[4])

                    print()

            s=0

            print("\t\tNON-VEG")

            for i in me:

                if i[1]=='non-veg':

                    s+=1

                    print(s,end=' ')

                    print(i[2].title(),':',i[3])

                    print("MRP :",i[4])

                    print()

        elif o==2:

            while True:

                print("""

┌────────────────────────────────────────┐

│              LA MEA KHOW               │

│                                        │

│             [1]. VEG                   │

│             [2]. NON-VEG               │

│             [3]. BACK                  │

└────────────────────────────────────────┘""")

                op=int(input("Enter the operation number = "))

                if op==3:

                    break

                elif op==1:

                    sno=eval(input("Enter the list of sno. of food = "))

                    cur.execute("select sno from menu where type='veg';")

                    vg=cur.fetchall()

                    for i in sno:

                        cur.execute('insert into t_%s values(%s)',(tbn,vg[i-1][0]))

                        mycon.commit()

                elif op==2:

                    sno=eval(input("Enter the list of sno. of food = "))

                    cur.execute("select sno from menu where type='non-veg';")

                    nvg=cur.fetchall()

                    for i in sno:

                        cur.execute('insert into t_%s values(%s)',(tbn,nvg[i-1][0]))

                        mycon.commit()

                else:

                    print("Invalid operation number entered")

        elif o==3:

            cur.execute('select * from t_%s;',(tbn,))

            odr=cur.fetchall()

            cur.execute('select sno,food_name,cost from menu;')

            det=cur.fetchall()

            sn=[]

            qty=[]

            for i in det:

                sn.append(i[0])

            for i in range(0,len(odr)):

                qty.append(sn.count(i))

            amt=0

            print("""

┌──────────────────────────────────────────────┐

│                  LA MEA KHOW                 │

│                                              │

│     FOOD ITEM                QTY   AMOUNT    │""")

            for i in range(0,len(odr)):

                if qty[i]>0:

                    amt+=det[i][2]*qty[i]

                    print("│    ",det[i][1]," "*(30-6-len(det[i][1])),qty[i]," "*(5-len(str(qty[i]))),det[i][2]*qty[i],' '*(15-len(str(det[i][2]*qty))),"│")

            

            print("""│                                   ------    │""")

            print("│       CGST(9%)                    ",int(amt*0.09),' '*(7-len(str(int(amt*0.09)))),"│")

            print("│       SGST(9.5%)                  ",int(amt*0.095),' '*(7-len(str(int(amt*0.095)))),"│")

            print("│       Service Charge(10%)         ",int(amt*0.10),' '*(7-len(str(int(amt*0.10)))),"│")

            print("│       Miscellaneous(2.5%)         ",int(amt*0.025),' '*(7-len(str(int(amt*0.025)))),"│")

            eat5(amt)

            food10(amt)

            foodie(amt)

            amt=amt+amt*(0.09+0.095+0.10+0.025)

            amt=int(amt)

            print("│          TOTAL                     ",amt,' '*(6-len(str(amt))),"│")

            print("└─────────────────────────────────────────────┘")

            cur.execute('drop table t_%s;',(tbn,))

            cur.execute("create table t_%s(item_no int);",(tbn,))

            mycon.commit()

        else:

            print("Invalid operation Entered")

mycon.close()


TRAFFICWISE

 import random as ran

import mysql.connector as msc

pwd='edward'

db='traffic'


con=msc.connect(host='localhost',user='root',passwd=pwd,database=db)

cur=con.cursor()

"""print(""Downlaod SQL setup?

[1]. Yes

[2]. No

"")

op=int(input("Enter the operation number = "))

if op==1:

    cur.execute("create table vehicleno(Vehicle_no varchar(12) primary key,Owner_name  varchar(40),regd_authority varchar(30),fuel_type varchar(20), Emission Norm int);")

    cur.execute("insert into vehicleno values('DL12CM6390','Rakesh Kumar','Janak Puri','Petrol',5);")

    con.commit()

    cur.execute("insert into vehicleno values('DL15SN6289','Saksham Singh','Bali nagar','Diesel',6);")

    con.commit()

    cur.execute("insert into vehicleno values('DL9SCA7383','krish sharma','Uttam nagar','Petrol',6);")

    con.commit()

    cur.execute("insert into vehicleno values('DL18CQ7392','Satish Bajaj','Tilak nagar','Petrol',6);")

    con.commit()

    cur.execute("insert into vehicleno values('DL5SAM2345','Mahinder Tanwar','Rajouri Garden','Diesel',5);")

    con.commit()

    cur.execute("create table roadfine(sno int primary key,offence_name varchar(100),MVA varchar(40),Offence_1 int,Offence_2 int);")

    cur.execute("insert into roadfine values(1,'Obstrcutive Driving','125/177 MVA',500,1500);")

    con.commit()

    cur.execute("insert into roadfine values(2,'Triple riding on two wheeler','194C MVA',1000,1000);")

    con.commit()

    cur.execute("insert into roadfine values(3,'Driving in NMV lanes','115/194(1) MVA',20000,20000);")

    con.commit()

    cur.execute("create table challan(sno int primary key,vehicle_no varchar(12),offence_MVA varchar(40),repetition int,amount int);")

    cur.execute("insert into challan values(1,'DL9SCA6180','125/177 MVA',1,500);")

    con.commit()

    cur.execute("insert into challan values(2,'DL9SCA6180','194C MVA',1,1000);")"""

def traffic_rulesfunc():

   traffic_rules = {

    "1. Regulatory Rules": [

        "1. Always stop at a red light.",

        "2. Obey speed limits according to road type (e.g., 50 km/h in urban areas, 120 km/h on highways).",

        "3. Stop completely at all stop signs before proceeding.",

        "4. Yield the right of way to vehicles and pedestrians as indicated by signs.",

        "5. Do not drive in lanes marked for buses, taxis, or emergency vehicles.",

        "6. Always drive on the correct side of the road according to local laws (e.g., right-hand or left-hand driving).",

        "7. Do not park in no-parking zones, including in front of fire hydrants or driveways.",

        "8. Use turn signals when changing lanes or making turns.",

        "9. Do not block intersections, even if the traffic light is green.",

        "10. Follow posted restrictions on vehicle weight, height, or width when crossing bridges or tunnels."

    ],

    "2. Warning or Cautionary Rules": [

        "1. Slow down when approaching a pedestrian crossing, and stop if pedestrians are present.",

        "2. Reduce speed in areas marked with “School Zone” during specific hours.",

        "3. Be cautious when driving on roads with 'Slippery When Wet' signs, especially during rain.",

        "4. Slow down before sharp turns marked with curve signs.",

        "5. Pay attention to deer or wildlife crossing signs in rural areas.",

        "6. Watch for roadwork or construction signs and follow posted speed limits in these zones.",

        "7. Be cautious when approaching areas with falling rocks or avalanche warnings.",

        "8. Drive slowly over speed bumps or humps marked with cautionary signs.",

        "9. Observe reduced speed limits on narrow bridges or roads marked as hazardous.",

        "10. Be alert for trains when you see railroad crossing warnings, and stop when required."

    ],

    "3. Informational or Guide Rules": [

        "1. Follow exit signs to leave highways or motorways safely.",

        "2. Pay attention to road number signs to stay on the correct route.",

        "3. Follow signs that indicate gas stations or rest areas.",

        "4. Observe signs indicating the distance to the next town or city.",

        "5. Use airport or bus station signs to find the correct entrances.",

        "6. Pay attention to highway markers showing directions to tourist attractions or landmarks.",

        "7. Follow hospital or emergency room signs to navigate safely in an emergency.",

        "8. Observe hotel or accommodation information signs for nearby lodging.",

        "9. Use parking signs to identify public parking lots or garages.",

        "10. Follow signs directing you to scenic viewpoints or rest stops along tourist routes."

    ],

    "4. Road Markings": [

        "1. Stay within your lane, and do not cross solid white or yellow lines.",

        "2. Use crosswalks when walking or stop for pedestrians at marked pedestrian crossings.",

        "3. Stop at the stop line at intersections controlled by traffic lights or signs.",

        "4. Do not park in areas marked with diagonal lines or hatching.",

        "5. Follow arrows painted on the road indicating turn-only lanes.",

        "6. Observe double yellow lines, which typically indicate no passing or overtaking zones.",

        "7. Park only in spaces marked for parking, and avoid loading zones or handicapped spots without a permit.",

        "8. Yield to traffic at intersections marked with yield triangles.",

        "9. Follow bike lane markings and avoid driving in them.",

        "10. Be aware of broken white lines indicating that lane changes are permitted, but with caution."

    ],

    "5. Priority Rules": [

        "1. Yield to pedestrians at marked or unmarked crosswalks.",

        "2. Give way to traffic coming from the right at uncontrolled intersections (where applicable).",

        "3. Yield to vehicles already in a roundabout.",

        "4. Give priority to emergency vehicles (ambulances, police, fire trucks) with flashing lights or sirens.",

        "5. Yield to buses re-entering traffic in some urban areas (where local laws apply).",

        "6. Allow vehicles to merge into traffic when entering highways or motorways.",

        "7. Yield to cyclists in bike lanes or when turning across a bicycle path.",

        "8. Give priority to vehicles going straight or turning right at traffic signals.",

        "9. Yield to trains at railroad crossings.",

        "10. Give priority to school buses when they are stopped for children to board or disembark."

    ],

    "6. Miscellaneous Rules": [

        "1. All passengers must wear seat belts while the vehicle is in motion.",

        "2. Do not use a handheld mobile phone while driving unless using a hands-free device.",

        "3. Motorcycle riders and passengers must wear helmets at all times.",

        "4. Do not drive under the influence of alcohol or drugs.",

        "5. Keep headlights on during low visibility conditions such as fog, rain, or nighttime.",

        "6. Use child car seats for children below a certain age or height (as required by local law).",

        "7. Always stop for school buses with flashing red lights indicating that children are boarding or disembarking.",

        "8. Do not litter or throw objects from the vehicle while driving.",

        "9. Keep the vehicle in good condition, including proper tire pressure and functioning brakes.",

        "10. Follow local regulations regarding vehicle modifications and accessories."

    ]}

   while True:

        for key in traffic_rules:

            print(key)

        choice = input("\nEnter the number of your chosen category (1-6), or 'q' to quit: ")

        if choice.lower() == 'q':

            break

        elif choice in ['1', '2', '3', '4', '5','6']:

            print ("----"*30)

            print("\n".join(traffic_rules[list(traffic_rules.keys())[int(choice) - 1]]))

            print("----"*30)

        else:

            print("Invalid choice. Please try again.")


def road_signs():

    categories = {

    "1. Regulatory Signs": ["Stop", "Yield", "Speed Limit", "No Entry", "No Parking", "No U-Turn", "One Way", "Pedestrian Crossing", "Turn Left Only", "No Overtaking"],

    "2. Warning Signs": ["Sharp Turn Ahead", "Pedestrian Crossing", "School Zone", "Slippery Road", "Animal Crossing", "Railroad Crossing", "Falling Rocks", "Road Narrows", "Speed Bumps", "Traffic Signal Ahead"],

    "3. Guide Signs": ["Highway Exit", "Route Marker", "Distance Sign", "Rest Area", "Hospital", "Gas Station", "City Name", "Airport", "Tourist Attraction", "Parking Information"],

    "4. Informational Signs": ["Hospital", "Gas Station", "Restaurant", "Rest Area", "Hotel/Motel", "Telephone", "Bus Stop", "Emergency Shelter", "Police Station", "Tourist Information"],

    "5. Temporary Traffic Control Signs": ["Detour", "Road Work Ahead", "Lane Closed", "Flagman Ahead", "Temporary Traffic Light", "Men at Work", "Uneven Road", "Construction Ahead", "End of Road Work", "Speed Limit in Construction Zone"]

}

    while True:

        for key in categories:

            print(key)

        choice = input("\nEnter the number of your chosen category (1-5), or 'q' to quit: ")

        if choice.lower() == 'q':

            break

        elif choice in ['1', '2', '3', '4', '5']:

            print ("────"*15)

            print("\n".join(categories[list(categories.keys())[int(choice) - 1]]))

            print("────"*15)

        else:

            print("Invalid choice. Please try again.")


def capmaker():

    a='abcdefghijklmnopqrstuvwxyz'

    A='ABCDEFGHIJKLMNOPQRSTUVWXYZ'

    c='@#_'

    ccap=''

    for i in range(0,6):

        cs=ran.randint(0,2)

        if cs==0:

            xa=ran.randint(0,25)

            ccap+=a[xa]

        elif cs==1:

            xA=ran.randint(0,25)

            ccap+=A[xA]

        elif cs==2:

            xc=ran.randint(0,2)

            ccap+=c[xc]

        ccap+=' '*ran.randint(0,3)

    return ccap



while True:

    print("""

┌──────────────────────────────────────────────────────────────────────┐

│                                                                      │

│                             ROAD SAFETY                              │

│                                                                      │

│    [1]. E-Challan        [2]. Safety Rules        [3]. Road Signs    │

│                                                                      │

│                               [4]. EXIT                              │

└──────────────────────────────────────────────────────────────────────┘""")

    o=int(input("\nEnter the operation number = "))

    if o==4:

        break

    elif o==1:

        while True:

            print("""

┌───────────────────────────────────────────┐

│                                           │

│                 E-CHALLAN                 │

│                                           │

│           [1]. CIVILIAN LOGIN             │

│           [2]. OFFICER  LOGIN             │

│           [3]. BACK                       │

│                                           │

└───────────────────────────────────────────┘""")

            op=int(input("Enter the operation number = "))

            if op==3:

                break

            elif op==1:

                vfy1=0

                vfy2=0

                while True:

                    if vfy1!=1:

                        vn=input("Enter Vehicle Number = ")

                        cur.execute("select vehicle_no from vehicleno;")

                        vhn=cur.fetchall()

                        for i in vhn:

                            if i[0].upper()==vn.upper():

                                vfy1=1

                    if vfy2!=1:

                        x=capmaker()

                        print(x)

                        xs=''

                        for i in x:

                            if i!=' ':

                                xs+=i

                        cp=input("Enter the capcha = ")

                        if cp==xs:

                            vfy2=1

                    if vfy1==1 and vfy2==1:

                        break

                    elif vfy1!=1 and vfy2!=1:

                        print("INVALID CAPCHA AND USERNAME")

                    elif vfy1!=1:

                        print("INVALID VEHICLE NO")

                    elif vfy2!=1:

                        print("INVALID CAPCHA")

                    

                cur.execute("select * from challan where vehicle_no=%s;",(vn,))

                off=cur.fetchall()

                cur.execute("select * from vehicleno where vehicle_no=%s;",(vn,))

                det=cur.fetchall()

                of=[]

                sz=[]

                mz=[]

                for i in off:

                    mva=i[2]

                    cur.execute('select offence_name from roadfine where mva=%s;',(mva,))

                    ofn=cur.fetchall()

                    of.append([mva,ofn[0][0]])

                    sz.append(len(ofn[0][0]))

                    mz.append(len(mva))

                sx=max(sz)

                mx=max(mz)

                print("""

┌──────────────────────────────────────────────────────────────────────┐

│                                                                      │

│                               E-CHALLAN                              │

│                                                                      │

│   Owner Name: {name}{sp1}│

│   Vehicle No.: {vhno}{sp2}│

│   Regd. Authority: {regd}{sp3}│

│                                                                      │

│   Offence name{sp4}Offence Act{sp5}Amount{sp6}│""".format(name=det[0][1],sp1=' '*(71-16-len(det[0][1])),vhno=det[0][0],sp2=' '*(71-17-len(det[0][0])),regd=det[0][2],sp3=' '*(71-21-len(det[0][2])),sp4=' '*(4+sx-11),sp5=' '*(4+mx-10),sp6=' '*(72-8-sx-3-mx-10)))

                for i in range(0,len(off)):

                      print('│   '+of[i][1]+' '*(1+4+sx-len(of[i][1]))+of[i][0]+' '*(1+4+mx-len(of[i][0]))+str(off[i][4])+' '*(70-3-8-sx-mx-2-len(str(off[i][4])))+'│')

                print('└──────────────────────────────────────────────────────────────────────┘')

                num=9999

                num=int(input("Enter any number to exit = "))

                if num!=9999:

                      break

            elif op==2:

                while True:

                    cvfy1=cvfy2=0

                    emp=int(input("Enter the employee code = "))

                    pwd=input("Enter the password = ")

                    cur.execute('select * from ofc_details;')

                    dt=cur.fetchall()

                    for i in dt:

                        if int(i[0])==emp:

                            cvfy1=1

                            if i[1]==pwd:

                                cvfy2=1

                    if cvfy1!=1:

                        print("Username not registered")

                    if cvfy2!=1:

                        print("Password Invalid")

                    if cvfy1==cvfy2==1:

                        break

                cur.execute("select * from roadfine")

                rdf=cur.fetchall()

                print()

                for i in rdf:

                    print(i[0],i[1],i[2],i[3],i[4])

                while True:

                    fn=eval(input("Enter tuple of sno = "))

                    ch=int(input("Enter 1 to confirm else 0 = "))

                    if ch==1:

                        break

                    elif ch==0:

                        None

                    else:

                        print("Invalid input entered")

                while True:

                    tvfy1=0

                    vn=input("Enter Vehicle Number = ")

                    cur.execute("select vehicle_no from vehicleno;")

                    vhn=cur.fetchall()

                    for i in vhn:

                        if i[0].upper()==vn.upper():

                            tvfy1=1

                    if tvfy1==1:

                        break

                    else:

                        print("INVALID VEHICLE NO.")

                cur.execute("select * from roadfine;")

                rdf=cur.fetchall()

                rf=[]

                for i in rdf:

                    if i[0] in fn:

                        mvt=i[2]

                        cur.execute("select * from challan;")

                        dt=cur.fetchall()

                        dt=len(dt)

                        cur.execute("select * from challan where offence_mva=%s and vehicle_no=%s",(mvt,vn))

                        rep=cur.fetchall()

                        rep=len(rep)

                        if rep==0:

                            fin=i[4]

                        else:

                            fin=i[3]

                        cur.execute("insert into challan values(%s,%s,%s,%s,%s);",(dt+1,vn,mvt,rep+1,fin))

                        con.commit()

                print("Challan successfully Created")

    elif o==2:

        traffic_rulesfunc()

    elif o==3:

        road_signs()

    else:

        print("INVALID OPERATION ENTERED")

con.close()


Sunday, July 7, 2024

Student Reocrd Keeper(CSV)

 import csv as c


def add(fn):

    try:

        with open(fn,'w') as f:

            w=c.writer(f)

            w.writerow(["Name","Age","Roll No.","Father's Name","Mother's Name","Subject 1","Subject 2","Subject 3","Subject 4","Subject 5","Percentage","Grade","Status"])

            n=input("Enter name = ")

            rn=int(input("Enter the roll number = "))

            ag=int(input("Enter the age = "))

            f=input("Enter father's name = ")

            m=input("Enter mother's name = ")

            m1=int(input("Enter marks of first subject = "))

            m2=int(input("Enter marks of second subject = "))

            m3=int(input("Enter marks of third subject = "))

            m4=int(input("Enter marks of fourth subject = "))

            m5=int(input("Enter marks of fifth subject = "))

            p=(m1+m2+m3+m4+m5)/5

            if 90<p<=100:

                g='A1'

            elif 80<p<=90:

                g='A2'

            elif 70<p<=80:

                g='B1'

            elif 70<p<=80:

                g='B2'

            elif 60<p<=70:

                g='C1'

            elif 50<p<=60:

                g='C2'

            elif 40<p<=50:

                g='D1'

            elif 30<p<=40:

                g='D2'

            elif p<=30:

                g='E'

            if p>=33:

                s="PASS"

            else:

                s="FAIL"

            w.writerow([n,ag,rn,f,m,m1,m2,m3,m4,m5,p,g,s])

    except:

        FileNotFoundError

        with open(fn,'a') as f:

            w=c.writer(f)

            n=input("Enter name = ")

            rn=int(input("Enter the roll number = "))

            ag=int(input("Enter the age = "))

            f=input("Enter father's name = ")

            m=input("Enter mother's name = ")

            m1=int(input("Enter marks of first subject = "))

            m2=int(input("Enter marks of second subject = "))

            m3=int(input("Enter marks of third subject = "))

            m4=int(input("Enter marks of fourth subject = "))

            m5=int(input("Enter marks of fifth subject = "))

            p=(m1+m2+m3+m4+m5)/5

            if 90<p<=100:

                g='A1'

            elif 80<p<=90:

                g='A2'

            elif 70<p<=80:

                g='B1'

            elif 70<p<=80:

                g='B2'

            elif 60<p<=70:

                g='C1'

            elif 50<p<=60:

                g='C2'

            elif 40<p<=50:

                g='D1'

            elif 30<p<=40:

                g='D2'

            elif p<=30:

                g='E'

            if p>=33:

                s="PASS"

            else:

                s="FAIL"

            w.writerow([n,ag,rn,f,m,m1,m2,m3,m4,m5,p,g,s])


def disp(fn):

    with open(fn,'r') as f:

        r=c.reader(f)

        l=[]

        for i in r:

            l.append(i)

        if len(l)>=3:

            print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

            print("Student Name\tAge\tRoll no. Father name\t Mother name\tSub1\tSub2\tSub3\tSub4\tSub5\tPercentage\tGrade")

            print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

            for i in range(2,len(l),2):

                print(l[i][0],'\t',l[i][1],'\t',l[i][2],'\t',l[i][3],'\t',l[i][4],'\t',l[i][5],'\t',l[i][6],'\t',l[i][7],'\t',l[i][8],'\t',l[i][9],'\t',l[i][10],'\t\t',l[i][11],'\t',l[i][12])

                print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

        else:

            print("File is Empty")


def search(fn,ro):

    with open(fn,'r') as f:

        r=c.reader(f)

        l=[]

        for i in r:

            l.append(i)

        l.pop(0)

        l.pop(0)

        co=-1

        for i in range(0,len(l),2):

            if int(l[i][2])==ro:

                co=i

        if co==-1:

            print("\nRecord not Found\n")

        else:

            print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

            print("Student Name\tAge\tRoll no. Father name\t Mother name\tSub1\tSub2\tSub3\tSub4\tSub5\tPercentage\tGrade")

            print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

            print(l[i][0],'\t',l[i][1],'\t',l[i][2],'\t',l[i][3],'\t',l[i][4],'\t',l[i][5],'\t',l[i][6],'\t',l[i][7],'\t',l[i][8],'\t',l[i][9],'\t',l[i][10],'\t\t',l[i][11],'\t',l[i][12])

            print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")


def modify(fn,ro):

    with open(fn,'r') as f:

        r=c.reader(f)

        l=[]

        for i in r:

            l.append(i)

        l.pop(0)

        l.pop(0)

        for i in range(0,len(l),2):

            if int(l[i][2])==ro:

                print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

                print("Student Name\tAge\tRoll no. Father name\t Mother name\tSub1\tSub2\tSub3\tSub4\tSub5\tPercentage\tGrade")

                print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

                print(l[i][0],'\t',l[i][1],'\t',l[i][2],'\t',l[i][3],'\t',l[i][4],'\t',l[i][5],'\t',l[i][6],'\t',l[i][7],'\t',l[i][8],'\t',l[i][9],'\t',l[i][10],'\t\t',l[i][11],'\t',l[i][12])

                print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")                

        co=-1

        while True:

            print("""What do you want to modify:

[1]. Student name

[2]. Age

[3]. Roll no.

[4]. Father name

[5]. Mother name

[6]. Subject 1

[7]. Subject 2

[8]. Subject 3

[9]. Subject 4

[10]. Subject 5""")

            n=int(input("Enter the data number = "))

            if n==1 or n==3 or n==4:

                b=input("Enter data = ")

                break

            elif n==2 or n==5 or n==6 or n==7 or n==8 or n==9 or n==10:

                b=int(input("Enter data = "))

                break

            else:

                print('\nInvalid operation entered\n')

        for i in range(0,len(l),2):

            if int(l[i][2])==ro:

                co=i

                l[i][n-1]=str(b)

        p=(int(l[co][5])+int(l[co][9])+int(l[co][6])+int(l[co][7])+int(l[co][8]))/5

        l[co][10]=p

        if 90<p<=100:

                g='A1'

        elif 80<p<=90:

            g='A2'

        elif 70<p<=80:

            g='B1'

        elif 70<p<=80:

            g='B2'

        elif 60<p<=70:

            g='C1'

        elif 50<p<=60:

            g='C2'

        elif 40<p<=50:

            g='D1'

        elif 30<p<=40:

            g='D2'

        elif p<=30:

            g='E'

        if p>=33:

            s="PASS"

        else:

            s="FAIL"

        l[co][11]=g

        l[co][12]=s

        if co==-1:

            print("Record not Found")

        else:

            with open(fn,'w') as f:

                w=c.writer(f)

                w.writerow(["Name","Age","Father's Name","Mother's Name","Subject 1","Subject 2","Subject 3","Subject 4","Subject 5","Percentage","Grade","Status"])

                for i in range(0,len(l),2):

                    w.writerow(l[i])

            print("\nRecord Modified successfully\n")


def delete(fn,ro):

    with open(fn,'r') as f:

        r=c.reader(f)

        l=[]

        for i in r:

            l.append(i)

        l.pop(0)

        l.pop(0)

        co=-1

        for i in range(0,len(l),2):

            if int(l[i][2])==ro:

                co=i

        if co==-1:

            print("Record not Found")

        else:

            l.pop(co)

            l.pop(co)

            with open(fn,'w') as f:

                w=c.writer(f)

                w.writerow(["Name","Age","Father's Name","Mother's Name","Subject 1","Subject 2","Subject 3","Subject 4","Subject 5","Percentage","Grade","Status"])

                for i in range(0,len(l),2):

                    w.writerow(l[i])

            print("\nRecord Deleted successfully\n")


while True:

    print("""Choose the operation to perform:

[1]. Add a Record

[2]. Display All Record

[3]. Search a Record

[4]. Modify a Record

[5]. Delete a Record

[6]. Exit""")

    o=int(input("Enter the operation number = "))

    if o==6:

        break

    elif o==1:

        add('sturec.csv')

        print("\nRecord added Successfully\n")

    elif o==2:

        disp('sturec.csv')

    elif o==3:

        r=int(input("Enter the roll number = "))

        search('sturec.csv',r)

    elif o==4:

        r=int(input("Enter the roll number = "))

        modify('sturec.csv',r)

    elif o==5:

        r=int(input("Enter the roll number = "))

        delete('sturec.csv',r)

    else:

        print("\nInvalild operation entered\n")

Thursday, June 6, 2024

STUDENT RECORD KEEPER

 def add(n):

    f=open('result.txt','a')

    x=n.split('#')

    for i in range(len(x)):

        f.write(x[i])

        if i==9:

            f.write('$')

        else:

            f.write('@')

    f.close()


def srch(a):

    f=open('result.txt')

    fr=f.read()

    fr=fr.split('$')

    c=0

    x=''

    for i in range(0,len(fr)-1):

        fr[i]=fr[i].split('@')

    for i in range(0,len(fr)-1):

        if int(fr[i][1])==a:

            x=fr[i]

            c=1

    f.close()

    return [c,x]


def edit(n,a,b):

    f=open('result.txt')

    fr=f.read()

    f.close()

    fn=open('result.txt','w')

    t=0

    fr=fr.split('$')

    for i in range(len(fr)-1):

        fr[i]=fr[i].split('@')

    for i in range(len(fr)-1):

        if int(fr[i][1])==a:

            fr[i][n]=str(b)

            t=1

        for j in range(len(fr[i])):

            fn.write(fr[i][j])

            if j==len(fr[i])-1:

                fn.write('$')

            else:

                fn.write('@')

    fn.close()

    return t


def disp():

    f=open('result.txt')

    fr=f.read()

    fr=fr.split('$')

    l=[]

    m=[]

    for i in range(0,len(fr)-1):

        fr[i]=fr[i].split('@')

        l.append([i,float(fr[i][9])])

        m.append(float(fr[i][9]))

    m.sort()

    i=j=0

    x=len(l)

    r=[]

    while len(l)>0 and j<x:

        if i==len(l):

            i=0

        if l[i][1]==m[j]:

            r.append(fr[l[i][0]])

            j+=1

        i+=1

    f.close()

    return r

def dell(a):

    f=open('result.txt')

    fr=f.read()

    f.close()

    fn=open('result.txt','w')

    t=0

    fr=fr.split('$')

    for i in range(len(fr)-1):

        fr[i]=fr[i].split('@')

    for i in range(len(fr)-1):

        if int(fr[i][1])==a:

            fr.pop(i)

            t=1

        for j in range(len(fr[i])):

            fn.write(fr[i][j])

            if j==9:

                fn.write('$')

            else:

                fn.write('@')

    fn.close()

    return t


while True:

    print("""Choose the operation to perform:

[1]. Add a record

[2]. Search a record

[3]. Display data

[4]. Edit a record

[5]. Delete a record

[6]. Exit""")

    o=int(input("Enter the operation number to perform = "))

    if o==6:

        print("Would you like to share feedback?")

        s=input("y/n ? = ")

        if s.lower()=='y':

            f=open("feedback250524","a")

            d=input("Enter your feedback : ")

            f.write(d)

            print("Thank you, your feedback is very valuable.")

            f.close()

        else:

            break

    elif o==1:

        sn=input("Enter Student name = ")

        fn=input("Enter Father name = ")

        mn=input("Enter Mother name = ")

        r=int(input("Enter Roll no. ="))

        s1=int(input("Enter marks of first subject = "))

        s2=int(input("Enter marks of second subject = "))

        s3=int(input("Enter marks of third subject = "))

        s4=int(input("Enter marks of fourth subject = "))

        s5=int(input("Enter marks of fifth subject = "))

        t=(s1+s2+s3+s4+s5)/5

        if 33<t<=100:

            p='PASS'

        else:

            p='FAIL'

        if 90<t<=100:

            r='A1'

        elif 80<t<=90:

            r='A2'

        elif 70<t<=80:

            r='B1'

        elif 60<t<=70:

            r='B2'

        elif 50<t<=60:

            r='C1'

        elif 40<t<=50:

            r='C2'

        elif 30<t<=40:

            r='D1'

        elif 20<t<=30:

            r='D2'

        else:

            r='E'

        n=sn+'#'+str(r)+'#'+fn+'#'+mn+'#'+str(s1)+'#'+str(s2)+'#'+str(s3)+'#'+str(s4)+'#'+str(s5)+'#'+str(t)+'#'+r+'#'+p

        add(n)

        print("RECORD ADDED")

    elif o==2:

        r=int(input("Enter Roll no. = "))

        c=srch(r)

        if c[0]==1:

            if len(c[1])>=1:

                print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

                print("Student Name\tRoll no.\tFather name\tMother name\tSub1\tSub2\tSub3\tSub4\tSub5\tPercentage\tGrade")

                print(c[1][0],'\t',c[1][1],'\t\t',c[1][2],'\t',c[1][3],'\t',c[1][4],'\t',c[1][5],'\t',c[1][6],'\t',c[1][7],'\t',c[1][8],'\t',c[1][9],'\t\t',c[1][10],'\t',c[1][11])

                print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

            else:

                print("No data available")

        else:

            print("Data not found")

    elif o==3:

        z=disp()

        print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

        print("Student Name\tRoll no.\tFather name\tMother name\tSub1\tSub2\tSub3\tSub4\tSub5\tPercentage\tGrade")

        for i in range(0,len(z)):

            print(z[i][0],'\t',z[i][1],'\t\t',z[i][2],'\t',z[i][3],'\t',z[i][4],'\t',z[i][5],'\t',z[i][6],'\t',z[i][7],'\t',z[i][8],'\t',z[i][9],'\t\t',z[i][10],'\t',z[i][11])

            print("──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────")

    elif o==4:

        a=input("Enter roll no. = ")

        print("""What do you want to modify:

[1]. Student name

[2]. Roll no.

[3]. Father name

[4]. Mother name

[5]. Subject 1

[6]. Subject 2

[7]. Subject 3

[8]. Subject 4

[9]. Subject 5

[10].Exit""")

        n=int(input("Enter the data number = "))

        if n==1 or n==3 or n==4:

            b=int("Enter element = ")

        elif n==10:

            break

        else:

            b=int(input("Enter element = "))

        c=edit(n-1,a,b)

        if c==1:

            print("Record updated")

        else:

            print("Record Does not exist")

    elif o==5:

        a=input("Enter Roll no. = ")

        c=dell(a)

        if c==1:

            print("Record Deleted")

        else:

            print("Record Does not exist")

print("""---------Thank You for accesing the program--------""")

CRICKET MATCH RECORD KEEPER

 import random as ran


'Tag\tPlayer\tBall played\tScore\tFall of Wicket\tSRR'


'''tags

B Batsman

BW Bowler

AR All rounder

W Wicket keeper

C captain'''


print("""Choose match type:

[1]. ODI

[2]. T-20

[3]. Custom Overs""")

mtch=int(input("Enter the match type = "))

if mtch==1:

    ovr=50

elif mtch==2:

    ovr=20

elif mtch==3:

    ovr=int(input("Enter total overs = "))

mnm=input("Enter match name = ")

def plnm(x,z):

    f=open(z+'.txt','a')

    for i in range(0,len(x)):

        if i==len(x)-1:

            f.write(x[i])

            f.write('$')

        else:

            f.write(x[i])

            f.write('@')


t1nm=input("Enter team-1 name = ")

f=open(t1nm+'.txt','w')

f.close()

print("Player details for TEAM "+t1nm)

for i in range(0,11):

    print(''' Choose player tag

B Batsman

BW Bowler

AR All rounder

W Wicket keeper

VC Vice Captain

C captain''')

    while True:

        tg=input("Enter Tag = ")

        if tg.upper() not in ['C','W','BW','AR','B']:

            print("Invalid Tag")

        else:

            break

    nm=input("Enter player name = ")

    print('────────────────────────────')

    plnm([tg.upper(),nm,'0','0','0','0','0'],t1nm)


t2nm=input("Enter team-2 name = ")

f=open(t2nm+'.txt','w')

f.close()

print("Player details for TEAM "+t2nm)

for i in range(0,11):

    print(''' Choose player tag

B Batsman

BW Bowler

AR All rounder

W Wicket keeper

VC Vice captain

C captain''')

    while True:

        tg=input("Enter Tag = ")

        if tg.upper() not in ['C','W','BW','AR','B']:

            print("Invalid Tag")

        else:

            break

    nm=input("Enter player name = ")

    

    print('────────────────────────────')

    plnm([tg.upper(),nm,'0','0','0','0','0'],t2nm)


#t1mt=[['C','Naman Arora',0,0,0,0,0],['VC','Kallu Singh',0,0,0,0,0],['W','Chiku Singh',0,0,0,0,0],['WB','Ravi Roy',0,0,0,0,0],['W','Saanu Satija',0,0,0,0,0],['WB','Raghu Chawla',0,0,0,0,0],['B','Zubaid Kumar',0,0,0,0,0],['B','Kanu Kumar',0,0,0,0,0],['AR','Laali Paaji',0,0,0,0,0],['AR','Kishan Lal',0,0,0,0,0],['B','Jyoti',0,0,0,0,0]]

#t2mt=[['C','Aman Arora',0,0,0,0,0],['VC','Montu Singh',0,0,0,0,0],['W','Chintu Singh',0,0,0,0,0],['WB','Ram Roy',0,0,0,0,0],['W','big Sannu',0,0,0,0,0],['WB','Ramu Chawla',0,0,0,0,0],['B','Zafar Kumar',0,0,0,0,0],['B','Shanu Satija',0,0,0,0,0],['AR','Chiku Bhai',0,0,0,0,0],['AR','Tim  cook',0,0,0,0,0],['AR','Kiku gupta',0,0,0,0,0],['B','Tiku mishra',0,0,0,0,0]]


def srttmA(far):

    fa=open(a+'.txt')

    far=fa.read()

    la=[]

    for i in range(0,len(far)):

        far[i]=far[i].split('@')

        la.append(far[i][0])

    tma=[]

    i=0

    while la.count('C')!=0:

        if far[i][0]=='C':

            tma.append(far[i])

            far.pop(i)

            la.pop(i)

            i-=1

        i+=1

    i=0

    while la.count('VC')!=0:

        if far[i][0]=='VC':

            tma.append(far[i])

            far.pop(i)

            la.pop(i)

            i-=1

        i+=1

    i=0

    while la.count('B')!=0:

        if far[i][0]=='B':

            tma.append(far[i])

            far.pop(i)

            la.pop(i)

            i-=1

        i+=1

    i=0

    while la.count('WB')!=0:

        if far[i][0]=='WB':

            tma.append(far[i])

            far.pop(i)

            la.pop(i)

            i-=1

        i+=1

    i=0

    while la.count('AR')!=0:

        if far[i][0]=='AR':

            tma.append(far[i])

            far.pop(i)

            la.pop(i)

            i-=1

        i+=1

    i=0

    while la.count('W')!=0:

        if far[i][0]=='W':

            tma.append(far[i])

            far.pop(i)

            la.pop(i)

            i-=1

        i+=1

    fb.close()

    return tma


def srttmB(fbr):

    fb=open(b+'.txt')

    fbr=fb.read()

    lb=[]

    for i in range(0,len(fbr)):

        fbr=fbr[i].split('@')

        lb.append(fbr[i][0])

    tmb=[]

    i=0

    while lb.count('C')!=0:

        if fbr[i][0]=='C':

            tmb.append(fbr[i])

            fbr.pop(i)

            lb.pop(i)

            i-=1

        i+=1

    i=0

    while lb.count('B')!=0:

        if fbr[i][0]=='B':

            tmb.append(fbr[i])

            fbr.pop(i)

            lb.pop(i)

            i-=1

        i+=1

    i=0

    while lb.count('WB')!=0:

        if fbr[i][0]=='WB':

            tmb.append(fbr[i])

            fbr.pop(i)

            lb.pop(i)

            i-=1

        i+=1

    i=0

    while lb.count('AR')!=0:

        if fbr[i][0]=='AR':

            tmb.append(fbr[i])

            fbr.pop(i)

            lb.pop(i)

            i-=1

        i+=1

    i=0

    while lb.count('W')!=0:

        if fbr[i][0]=='W':

            tmb.append(fbr[i])

            fbr.pop(i)

            lb.pop(i)

            i-=1

        i+=1

    fb.close()

    return tmb


tm1=srttmA(t1mt)

tm2=srttmB(t2mt)

print('\t'+t1nm)

print("│ TAGS\tPLAYERS")

for i in range(0,len(tm1)):

    print('│',tm1[i][0],'\t',tm1[i][1])

print('\n')

print('\t'+t2nm)

print("│ TAGS\tPLAYERS")

for i in range(0,len(tm2)):

    print('│',tm2[i][0],'\t',tm2[i][1])

tms=[[t1nm,tm1],[t2nm,tm2]]


print("""Choose the Batting team:

[1]."""+t1nm+"""

[2]."""+t2nm)

tm=int(input("Enter the team No. =  "))

tmbt=tm-1

tmbl=2-tmbt-1


def chsbtmn(tmbt):

    print()

    for i in range(0,11):

        print(i+1,tms[tmbt][1][i][1])

    while True:

        b1=int(input("Select batsman number = "))

        if 0<b1<=11 and int(tms[tmbt][1][b1-1][6])<1:

            b=b1-1

            tms[tmbt][1][b1-1][6]=1

            break

        else:

            print("PLAYER CANNOT BE SELECTED")

    return b


def chsblmn(tmbl):

    print()

    for i in range(0,11):

        print(i+1,tms[tmbl][1][i][1])

    while True:

        b1=int(input("Select Bowler number = "))

        if 0<b1<=11:

            b=b1-1

            break

        else:

            print("PLAYER CANNOT BE SELECTED")

    return b


print('\nMATCH BEGINS')

scr1=1

print('───────────────')

for i in range(0,2):

    if i==1:

        tmbl,tmbt=tmbt,tmbl

        print("TEAM",tms[tmbl][0],"RUNS :",scr1)

        print("SECOND INNING BEGINS")

    ot=0

    b1=chsbtmn(tmbt)

    b2=chsbtmn(tmbt)

    bp=chsblmn(tmbl)

    print("OPENING BATSMAN :",tms[tmbt][1][b1][0],tms[tmbt][1][b1][1])

    bl=1

    ov=1

    scr2=0

    while True:

        if i==1:

            if scr2>=scr1:

                break

        print("Striker :",tms[tmbt][1][b1][1])

        print("Bowler :",tms[tmbl][1][bp][1])

        print("Runs :",int(tms[tmbt][1][b1][3]))

        print("SRR :",int(tms[tmbt][1][b1][5]))

        if i==1:

            print("Target :",scr1)

        if bl>6:

            ov+=1

            if ov>ovr:

                break

            bl=1

            bp=chsblmn(tmbl)

        print("OVER :",ov)

        print("BALL :",bl)

        bl+=1

        print("""Choose the entry

    [1]. Run

    [2]. Out""")

        op=int(input("Enter option number = "))

        if op==1:

            while True:

                r=int(input("Enter Runs = "))

                if 0<=r<=6:

                    tms[tmbt][1][b1][3]=int(tms[tmbt][1][b1][3])+r

                    tms[tmbt][1][b1][2]=int(tms[tmbt][1][b1][2])+1

                    if i==0:

                        scr1+=r

                    elif i==1:

                        scr2+=1

                    tms[tmbt][1][b1][5]=int(tms[tmbt][1][b1][3])/int(tms[tmbt][1][b1][2])

                    if int(tms[tmbt][1][b1][3])==50:

                        print("It's a HALF CENTURY")

                        print('┌─────   ┌─────┐')

                        print('│        │     │')

                        print('└─────┐  │     │')

                        print('      │  │     │')

                        print('──────┘  └─────┘')

                    elif int(tms[tmbt][1][b1][3])==100:

                        print("It's a CENTURY")

                        print('   /│     ┌─────┐ ┌─────┐')

                        print('  / │     │     │ │     │')

                        print('    │     │     │ │     │')

                        print('    │     │     │ │     │')

                        print('────┴──── └─────┘ └─────┘')

                    if r==1 or r==3 or r==5:

                        b1,b2=b2,b1

                    elif r==4:

                        print("It's a FOUR")

                        print('│     │')

                        print('│     │')

                        print('└─────┤')

                        print('      │')

                        print('      │')

                    elif r==6:

                        print("It's a SIX")

                        print('┌───── ')

                        print('│      ')

                        print('├─────┐')

                        print('│     │')

                        print('└─────┘')

                    break

                else:

                    print("INVALID RUNS ENTERED")

        elif op==2:

            print(tms[tmbt][1][b1][1],"OUT by",tms[tmbl][1][bp][1])

            tms[tmbt][1][b1][6]=2

            b1=b2

            b2=chsbtmn(tmbt)

            tms[tmbl][1][bp][4]=int(tms[tmbl][1][bp][4])+1

            ot+=1

            if ot==10:

                print("ALL OUT")

                if i==1:

                    print("Team",tsm[tmbl][1],'Won by',cr1-cr2,'Runs')

                break


def flwrt(a,b):

    fa=open(a+'.txt','w')

    for i in range(0,len(b)):

        for j in range(0,len(b[i])):

            if j==len(b[i])-1:

                fa.write(str(b[i][j]))

                fa.write('$')

            else:

                fa.write(str(b[i][j]))

                fa.write('@')

    fa.close()

flwrt(tms[0][0],tms[0][1])

flwrt(tms[1][0],tms[1][1])

def stddev(a):

    fa=open(a+'.txt')

    far=fa.read()

    far=far.split('$')

    for i in range(0,len(far)):

        far[i]=far[i].split('@')

    lba=[]

    lbl=[]

    for i in range(0,len(far)-1):

        if float(far[i][2])==0:

            far[i][2]='1'

        barr=float(far[i][3])/float(far[i][2])

        borr=float(far[i][4])/float(far[i][2])

        lba.append(barr)

        lbl.append(borr)

    brr=max(lba)

    bll=max(lbl)

    return [far[lba.index(brr)],far[lbl.index(bll)]]


tm1=stddev(t1nm)

tm2=stddev(t2nm)


if tm1[0]>=tm2[0]:

    print(t1nm)

    print("STABLE BATTING")

    print('───────────────────────────────────────────────────────────────────────────────')

    print('Tag\t Player Name\t Ball Played\t Score\t Fall Of Wickett\ SRR')

    print(tm1[0][0],'\t',tm1[0][1],'\t',tm1[0][2],'\t',tm1[0][3],'\t',tm1[0][4],'\t',tm1[0][5])

else:

    print(t2nm)

    print("STABLE BATTING")

    print('───────────────────────────────────────────────────────────────────────────────')

    print('Tag\t Player Name\t Ball Played\t Score\t Fall Of Wickett\ SRR')

    print(tm2[0][0],'\t',tm2[0][1],'\t',tm2[0][2],'\t',tm2[0][3],'\t',tm2[0][4],'\t',tm2[0][5])


if tm1[1]>=tm2[1]:

    print(t1nm)

    print("STABLE BOWLING")

    print('───────────────────────────────────────────────────────────────────────────────')

    print('Tag\t Player Name\t Ball Played\t Score\t Fall Of Wickett\ SRR')

    print(tm1[1][0],'\t',tm1[1][1],'\t',tm1[1][2],'\t',tm1[1][3],'\t',tm1[1][4],'\t',tm1[1][5])

else:

    print(t2nm)

    print("STABLE BOWLING")

    print('───────────────────────────────────────────────────────────────────────────────')

    print('Tag\t Player Name\t Ball Played\t Score\t Fall Of Wickett\ SRR')

    print(tm2[1][0],'\t',tm2[1][1],'\t\t',tm2[1][2],'\t',tm2[1][3],'\t',tm2[1][4],'\t',tm2[1][5])

    

def scrcrd(a,b):

    fa=open(a+'.txt')

    far=fa.read()

    far=far.split('$')

    for i in range(0,len(far)):

        far[i]=far[i].split('@')

    fa.close()

    fb=open(b+'.txt')

    fbr=fb.read()

    fbr=fbr.split('$')

    for i in range(0,len(fbr)):

        fbr[i]=fbr[i].split('@')

    fb.close()

    return [far,fbr]


s=scrcrd(t1nm,t2nm)


print('\t\t'+t1nm)

print("│Tag\t Player Name\t Ball Played\t Score\t Fall Of Wicket\tSRR")

for i in range(0,len(s[0])-1):

    print('│',s[0][i][0],'\t',s[0][i][1],'\t',s[0][i][2],'\t\t',s[0][i][3],'\t',s[0][i][4],'\t\t',round(float(s[0][i][5])))

print('\n')

print('\t\t'+t2nm)

print("│Tag\t Player Name\t Ball Played\t\t Score\t Fall Of Wicket\tSRR")

for i in range(0,len(s[1])-1):

    print('│',s[1][i][0],'\t',s[1][i][1],'\t',s[1][i][2],'\t\t',s[1][i][3],'\t',s[1][i][4],'\t\t',round(float(s[1][i][5])))