vtcbca / internal-exam-23bca261

23bca-python-sqlite-internal-exam-303-PYTHON-EXAM created by GitHub Classroom
0 stars 0 forks source link

count block #2

Open 23bca261 opened 2 weeks ago

23bca261 commented 2 weeks ago

table me number of student count per block kaise kare

mera program:Create csv file exam(sid,sname, seatno, blocknumber) using writer object with 10 records. Read this file and count students per block

23bca275 commented 1 week ago

bhai agar error hoto screenshot upload krde taaki jyada understand ho kya error he ya fir doubt kaha pe he uska..

23bca261 commented 1 week ago

student ko per block count me kaise kar na he vo samaj nahi aa raha hai

23bca274 commented 1 week ago

table me number of student count per block kaise kare

mera program:Create csv file exam(sid,sname, seatno, blocknumber) using writer object with 10 records. Read this file and count students per block

First open file in read mode " r " and then you can count students per block by using " for loop ".

Ex:

block_count = { } with open("student.csv","r") as f: reader = csv.reader(f) next(reader)

for row in reader:
    block = row[3]
    if block in block_count:
        block_count[block] += 1
    else:
        block_count[block] = 1

@23bca261

23bca261 commented 1 week ago

Okk , I will run this program in pc.

@23bca274