You are on page 1of 3

DCIT23-Assignment-4

Write a python program for each of the following problems.


Save your answers into a python program file (.py file). The program file should be able to
execute without error when run by the python interpreter.
With your username and password, login to https://bsit-app.herokuapp.com/ and upload the
python file.
Visit the website for the deadline of submission.

A. The text below is a list of students, their section, and their grades. The first row is the column
headings for the data which is separated by semi-colon. Using python, store the text in a variable
studs_grades as a multi-line text and save it to a file named studs_grades.txt .

STUDENT;SECTION;GRADE
Abordo;BSIT4A;2.25

Agustin;BSIT4A;1.75

Asiatico;BSIT4A;3.00

Asilo;BSIT4A;2.75

Bernabe;BSIT4A;2.25

Borja;BSIT4A;2.00

Botabara;BSIT4A;3.00

Cagoco;BSIT4A;3.00

Cariño;BSIT4A;3.00

Cruz;BSIT4A;3.00

Dapatnapo;BSIT4A;3.00
Darupan;BSIT4A;2.25

Delos Reyes;BSIT4A;3.00

Ono;BSIT4A;3.00

Torres;BSIT4A;2.50

Ugale;BSIT4A;2.25

Elpedes;BSIT4B;3.00

Endozo;BSIT4B;2.50

Estrada;BSIT4B;3.00

Evangelista;BSIT4B;2.75

Fernandez;BSIT4B;3.00
Flores;BSIT4B;3.00

Gayeta;BSIT4B;2.25

Gernale;BSIT4B;2.25

Guarino;BSIT4B;2.50

Lecaros;BSIT4B;3.00

Legarda;BSIT4B;2.50

Longcop;BSIT4B;2.75

Mabansag;BSIT4B;2.75

Malaluan;BSIT4B;2.50

Manaba;BSIT4B;2.25

Manarin;BSIT4B;3.00

Mengol;BSIT4B;3.00

Opriasa;BSIT4B;2.50

Pangan;BSIT4B;1.75

Cortez;BSIT4C;3.00

Pantilag;BSIT4C;2.25

Penuliar;BSIT4C;3.00

Relojo;BSIT4C;3.00

Reyes;BSIT4C;2.75

Salazar;BSIT4C;3.00

Santiago;BSIT4C;2.25

Seberre;BSIT4C;3.00

Suayan;BSIT4C;3.00

Sulit;BSIT4C;3.00

Tejada;BSIT4C;2.50

Tura;BSIT4C;2.25

Tuvieron;BSIT4C;1.75

Vicente;BSIT4C;2.25

Yacub;BSIT4C;2.75

B. Next, open the studs_grades.txt file and read the data into python variables for processing
to create a dictionary named studs_dict with sample items as shown below:

{'STUDENT': ['Abordo', 'Agustin', ...],

'SECTION': ['BSIT4A', 'BSIT4A', ...],

'GRADE': [2.25, 1.75, ...]

}
C. Next, based on the data of studs_dict , make a formatted display of the number of students
per grade, as shown below:

Grade Student Count


----- -------------
1.75 3
2.00 1
2.25 11
2.50 7
2.75 6
3.00 22
D. Next, define a function named list_students(param_data) that requires a data as a
parameter. The function will be used later to make a formatted display of a list of students, with their
section and grade, as illustrated below:

Student Section Grade

--------------- ---------- -------

Evangelista BSIT4B 2.75

Gayeta BSIT4B 2.25

Gernale BSIT4B 2.25

Guarino BSIT4B 2.50

... ... ...

E. Next, based on data of studs_dict , and using the function list_students , display the
alphabetical list of students with grades higher than 2.0 (it means, between 1.0 and 1.75), as shown
in sample below:

Student Section Grade

--------------- ---------- -------

Agustin BSIT4A 1.75

Pangan BSIT4B 1.75

... ... ...

F. Next, based on data of studs_dict , and using the function list_students , display the
alphabetical list of students with grades between 2.00 and 2.75, as shown in sample below:

Student Section Grade

--------------- ---------- -------

Abordo BSIT4A 2.25

Asilo BSIT4A 2.75

Bernabe BSIT4A 2.25

... ... ...

G. Next, based on data of studs_dict , and using the function list_students , display the
alphabetical list of students with grades equal to 3.0, as shown in sample below:

Student Section Grade

--------------- ---------- -------

Asiatico BSIT4A 3.00

Botabara BSIT4A 3.00

Cagoco BSIT4A 3.00

... ... ...

H. Finally, based on data of studs_dict , and using the function list_students , display the
alphabetical list of students who belong to BSIT4A, as shown in sample below:

Student Section Grade

--------------- ---------- -------

Abordo BSIT4A 2.25

Agustin BSIT4A 1.75

Asiatico BSIT4A 3.00

... ... ...

You might also like