Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
32 views

Python Assignment

python

Uploaded by

tmgsangeeta0315
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Python Assignment

python

Uploaded by

tmgsangeeta0315
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 32

1

Acknowledgement
3
4

1. Introduction and Assumption


1.1 Introduction
TQMS is a test question management information system tailored to aid academic institutions
in the creation, management, and organization of test and exam questions. The system has various
functionalities for the following three primary user roles: Academic Admin, Registered Lecturers, and
Exam Unit Personnel. Log in, addition, or modification of data, and the creation or management of
exam papers are functions attached to permissions for each user role.
The TQMS saves on time and effort since the structured approach in question management
ensures that all generated questions are relevant and challenging for the students and conforming to the
academic needs of the institution. The system helps in maintaining a uniform and organized repository
of test questions and examination papers.

1.2 Assumption
 The system assumes that all users have basic knowledge of how to operate a web-based
application.
 Stored user credentials and three attempts at log in to avoid crackers.
 The system shall assume, about the subjects and topics, that they will be predefined and
that users will act under these constraints.
 The application is designed to run in a local environment or a secure server with access to
the file system for storing data.
 The program assumes that the user will always input valid data types, such as names being
texts and contact details being numbers, among others, and follow the system prompts
correctly

2. Flowchart
Fig1:
The whole program by using flowcharts
5

The client is provided with four options as indicated in the flowchart above. Within the
diamond box is the options condition. The following true condition logic is carried out when the user's
input matches the switch condition statement. For instance, the program will open the admin window
if the user enters 1. Additionally, it will request your password and login username.

Fig2:
6

Flowchart of Academic Admin

According to the admin flowchart, utilizing after admin windows first requires the admin your
login information. The task options are displayed in the windows as indicated in the switch case
following a successful login. The next task is completed once the input matching the switch case
statement is executed properly
7

Fig3:
Flowchart of Registered Lecturer

The individual must first log in with the correct login information as indicated in the lecturer
window flowchart. Task list options appear in the window following a successful login. The task can
be completed by the user as specified in the switch case. The task that follows is carried out once the
input that satisfies the condition is executed.

Fig4:
8

Flowchart of Exam Unit Personnel

In the given Exam Personnel window flowchart, the user at first is required to login with correct
login information. Task list options appear in the window following a successful login. The task can
be completed by the user as specified in the switch case. The task that follows is carried out after the
input that satisfies the condition is executed.
9

3. Programming Concepts
3.1 Application of storage type (text file)
i. Text files:

The system achieves persistent storage of users, questions, and examination papers through
text files. This may be regarded as simple but effective, in that it is quite adequate for small
applications whose magnitude and data integrity are not critically dependent on some complex
database system (Fagbuyiro, 2022). In our Test Question Management System (TQMS) program, we
have implemented text files as the storage medium to store the data. Below is the example of creating
and storing the subject into the text file.
Example:
Fig 5: text file

ii. List:
Lists are a very useful variable type in Python. A list can contain a series of values. List
variables are declared by using brackets [ ] following the variable name (Fugier, 2018).
A=[] # This is a blank list variable
B = [1, 23, 45, 67] # this list creates an initial list of 4 numbers.
C = [2, 4, 'john'] # lists can contain different variable types.
10

iii. Tuple:

Purpose: One of the major use cases for tuples in Python is collections of data that need to
remain immutable. For example, predefined options: user roles or question categories.
Example: Tuples are immutable, which are used to store small amounts of data that are not
going to change, like configuration settings or item categories (Real Python, 2023).

iv. Dictionary:

Purpose: A dictionary in Python is a very helpful, inbuilt data type that stores data in the form
of key-value pairs. This is an unordered, mutable, indexed collection. All keys in a dictionary
are unique and refer to values (Tutorialspoint, n.d.).

Example: Dict1= {“comp”: “computer”, “sci”: “science”

Dict2= {“123”:” computer”,456: “math’s”

3.2 Application of control structure:


a. Selective
There are decision-making scenarios in the application that selective control structures such as
if-else statements can deal with. They let the program execute various blocks of code depending on
certain conditions.

 If else statement:
The true and false parts of a given condition are executed using the if-else
statement. The if block code is executed when the condition is true, and the else
block code is carried out when the condition is false (Biswal, 2024). Below is the
figure of if else condition applied on our program:
11

Fig 6: If else

 Nested if:
A nested if statement is one that is the destination of another if statement.
"Nestled if statement" describes an if statement inside another if statement. If
statements can be nested inside other if statements in Python. As a result, we can
nest if statements inside of one another (Dhanwani, 2023).
Fig 7: Nested if
12

b. Iteration:
 For Loop:
An object that lets you iterate over data collections, like lists, tuples, dictionaries, and sets, is
called an iterator in Python (Ramos, Real python, 2013). The iterator design pattern, which
enables you to navigate a container and access its elements, is implemented by Python
iterators.
Fig 8: for loop

 While Loop:
While a condition is True, a while loop will execute a section of code. Until the specified set of
code statements is no longer true, it will continue to execute them (Lemonaki, 2021).
Fig 9: While loop
13

3.3 Application of Try Expect:


Try-Except statement is a code block that allows your program to take alternative actions in
case an error occurs (python, 2023). Below is the figure of Tre Expect utilized in our program:

Fig 10: Try Expect

3.4 Application of validation:

We must verify that user input is valid before accepting it. This makes sure the data is what we
expected it to be. Below is the validation check of date applied on our program. It checks the input
date from the user and checks the date validity. If True then it will return the date and if fails the
validation check then it will again ask the user for correct date input.
Fig 11: Validation
14

3.5 The flow of add function:


In the program that we have developed, for adding the lecturer we will first select the create
option from the admin window.
Fig 12: add function

After selecting the creating new lecturer option i.e. (case 1), the following create function gets
called.

The following create function invokes the input new user function.
15

In input_new_user function the data is collected from the user through input which gets stored
in the variable result.
16

After it, the create_user function is called in which the text file name and result is passed as
argument to it.

In the create_user function the arguments are received and the data are then written to the text
file with the name value received on the filename argument.

3.6 The flow of edit/update function:


In the program that we have editing/updating which help involves finding an item in the
existing data structure and changing its value
Fig 13: edit function
17

The above update user function accepts the arguments and writes the data into the text file.

The updated data gets reflected and written on lecturer.txt file and the updating of the lecturer
is completed.

3.7 The flow of delete function:


From the code we can run a delete function step to step finding of an item and removing it
from the data structure from the main window.
Fig 14: delete function
18

After selection of deleting lecturer option i.e. (case 5), the following delete function gets
called.

The user is prompted to enter the username to be deleted by the following delete function. The
check_user function is then called, accepting the user's username and determining whether or not the
user is available. Additionally, the delete function—which takes two arguments, filename and
username is called if the username is available. The user with the matching username is then removed
from the lecturer.txt file by the deletes function.
19

3.8 The flow of generating reports:


In the program that we have developed, for generating the data into the text files, we are
utilizing:
with open (filename, “w”) as file: file. WriteLine(data)
The above statement is used in multiple functions which were utilized in various purposes of
the program such as creating new lecturer/exam_personnel/subjects etc. Few examples of it are shown
below:
Fig 15: Reports
20

In the above functions, filename parameter defines the text file to which the data is written.
Our Test Question Management System (TQMS) has generated several reports/data in the text file.
Some txt files generated in our program are as follows:
21

4. Sample Input and Output of the Source Code


4.1 Main Panel
This is the main panel of TQMS. This panel provides text-based menu system where it helps
users to select their roles in the respective menu.
Figure16: Main Panel

4.2 Admin window


Figure 17: Add Lecturer input
22

After entering choice 1 from the main panel, the admin panel will be displayed where it has 9
different choices. Create a new lecture, edit lecture details, read lecture details, view all lecture, delete
lecture, create exam personnel, delete an exam personnel, create new subject and back to new window.

Figure 18: Create a new Lecturer input and output


23

4.3 Delete lecturer input


Figure 19: Delete lecturer input

After entering the data, it again goes back to admin panel and choose choice no 5 where it will delete
data of the file which we have created in lecture text file.
24

4.4 Add personal input and output


Figure 20: Add exam personal input

This is the input of add exam personal where the quired question of data need to enter. All this
data of personal is saved in exam personnel text.
25

4.6 Edit /Update lecturer Input and Output


Figure 22: Update lecture input and output

Edit/Update lecturer can be seen as like how that data are being updating in the system.

4.7 Lecturer Panel


Figure 23: Lecturer Panel
26

To enter the lecture panel, it needs go through the main panel by entering the choice with
correct password and username.

4.8 Create question answer


Figure 24: Add Questions

Lecturer add the question according to it topic and subject. The question can be saved in
QnA.text file. If the subject is not according to the topic than it will show the subject not found
because of validation.
27

4.9 Creates exam Question Input and Output

Figure 25: Creates exam Question Input and output

After entering the username and password will give choices for set A or B question can be
created in set A or set B text file.
28

4.10 Read Question input and output


Figure 26: Read Question

4. Conclusion
The Test Questions Management System is a good illustration of many Python programming
concepts in use, including concepts on file handling, data structures, and control structures. This
project organizes such elements within a real-world application and thus shows how software can
make hard tasks easy, like test question management. The text files for storage, along with methods
that effectively process data using lists, tuples, and dictionaries, make the system functional while
being easy and simple. A little further down the road, improvements can be made like moving to
database if the system is to be deployed in bigger organizations or more advanced user management
features for making the system more robust and user-friendly.

5. References
29

Biswal, B. A. (2024, jul 10). simplelearn. Retrieved from Understanding Python If-Else Statement:
https://www.simplilearn.com/tutorials/python-tutorial/python-if-else-statement#:~:text=The
%20if%2Delse%20statement%20is,else%20block%20code%20is%20executed.

Criveti, M., & Gupta, M. (2023, December 15). Retrieved from IBM:
https://www.ibm.com/reference/python/for-loop

Dhanwani, A. (2023, march 10). Control structures. Retrieved from codingal:


https://www.codingal.com/coding-for-kids/blog/control-structures-in-python/#:~:text=Python
%20allows%20us%20to%20nest,one%20if%20statement%20inside%20another.&text=Since
%20the%20condition%20inside%20the%20if%20is%20true%20and%20the,nested%20if
%20loop%20is%

Fagbuyiro, D. (2022, august 26). File Handling in Python – How to Create, Read, and Write to a File.
Retrieved from freecodecamp: https://www.freecodecamp.org/news/file-handling-in-python/

Fugier, D. (2018, december 12). Python data type. Retrieved from RhinoDeveloper:
https://developer.rhino3d.com/guides/rhinopython/python-datatypes/

Lemonaki, D. (2021, august 31). freecodecamp. Retrieved from Python Do While – Loop Example:
https://www.freecodecamp.org/news/python-do-while-loop-example/#:~:text=A%20while
%20loop%20will%20always,number%20%3D%20number%20%2B%201

Python . (n.d.). Python documentation. Retrieved from Python :


https://docs.python.org/3/tutorial/datastructures.html

python. (2023, march 1). Retrieved from Python Try Except: Examples And Best Practices:
https://python.land/deep-dives/python-try-except

Python If Else Statement - Conditional Statements. (2024, June 20). Retrieved from Greeks for Greeks:
https://www.geeksforgeeks.org/python-if-else/

Ramos, L. P. (2013). Real python. Retrieved from Iterators and Iterables in Python: Run Efficient
Iterations: https://realpython.com/python-iterators-iterables/#:~:text=in%20your
%20code.-,What%20Is%20an%20Iterator%20in%20Python%3F,container%20and%20access
%20its%20elements.
30

Ramos, L. P. (2023, July 19). Real Python. Retrieved from https://realpython.com/python-list/

Real Python. (2023, November 06). Python's tuple Data Type: A Deep Dive With Examples. Retrieved
from Real Python: https://realpython.com/python-tuple/

Tutorialspoint. (n.d.). Python - dictionaries. Retrieved from Tutorialspoint:


https://www.tutorialspoint.com/python/python_dictionary.htm

6. Appendix
7.1 Work Breakdown Table

Group Members Task Signature


Sangita Tamang Exam Personnel Module,
(NP069844) Flowchart of admin
module, Documentation
Shirish Adhikari Lecturer Module
(NP069836) Development, Flowchart of
lecturer module
Sunil Kumar Admin Module
(NP069698) Development, Flowchart of
lecturer module
Aagendra Sunar Admin Module
(NP069581) Development, Overall
system flowchart

7.2 Screen shot of every text file content


Lecture text file
31

Exam personnel text file

Subject text file

Question and Answer text file


32

Question set A and B text file

You might also like