0% found this document useful (0 votes)
9 views6 pages

Python Assignment: Expense Tracker & IPL Directory

yes

Uploaded by

shivang214
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Python Assignment: Expense Tracker & IPL Directory

yes

Uploaded by

shivang214
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment 3 – Python

Software System Development – Monsoon 2023


Due Date: 04th Nov, 2023, 11:59 PM

Instructions:
➢ This assignment is an individual submission.
➢ Total Marks of 100 Marks with duration of 3 weeks.
➢ All script submissions should be submitted via moodle
➢ Inputs/output should fit the criteria mentioned in the respective question.
➢ All other conditions are open to your interpretations.
➢ Evaluation will be conducted based on a fixed grading rubric (syntax, logic,
input and output) and the marks are divided as per prescribed weightage in
respective questions.
➢ The assignment must be made in Python only.
➢ You are free to use any libraries that you deem fit, except when mentioned in
the particular question.
➢ For queries, reach out to TAs via Moodle

Submission Criteria:
➢ Please create one ZIP file as <rollnumber>_A3.ZIP
➢ Include all your scripts inside the ZIP as follows <rollnumber>_A3_Q1.py,
<rollnumber>_A3_Q2.py, <rollnumber>_A3_Q3.py and [Link] (to
provide any instructions to evaluator or your notes)
➢ For Example:

2022201079_A3.zip

|_____2022201079_A3

|_____2022201079_A3_Q1.py

|_____2022201079_A3_Q2.py

|_____2022201079_A3_Q3.py

|_____README.md
Question 1: (30 Marks)
Expense Tracker
You have to design a Menu based Expense Tracker. The menu will be of the
following format:
Menu:
● Add participant(s)
● Add expense
● Show all participants
● Show expenses
● Exit/Export.

Explanation
● Add participant(s): Enter 1 or more than 1 unique names who will
participate in the transactions.
● Add expense: On entering this option you, have to take 3 further inputs:
○ Paid by: <Name of the person who paid the money>
○ Amount: <The amount paid by the person>
○ Distributed amongst: <All the participants that are involved in this
payment.>
■ You can take the number of participants first and then take the
name of each person or you can take one string and tokenize it.
It’s your choice.
■ The split is always equal among the mentioned names.
● Show Participants: Just display all participants that are currently there.
● Show expenses: A table should be displayed showing each person’s
expenses. The table must be divided into 2 columns for each participant.

Participant’s Name

Amount “Owes” or “Gets Back”

○ Note that the table must contain each participant. The above table is a
subset of the table showing only one participant.
● Exit/Export: On exiting, you have to write back the data in a .csv file. The
name of the file should be “[Link]”. The data arrangement in the csv
file is up to you.
Note: Write the program covering all the logical edge cases that you can identify.
Rest all details are up to you and should be mentioned in the [Link].

Question 2: (40 Marks)


You have been made the analyst for the IPL team “Gachibowli Gorillas”. You have to
build a “Cricketer’s Directory” in python. The directory consists of a list of entries.
Each entry can store details such as:
1. First Name
2. Last Name
3. Age
4. Nationality
5. Role (Batsmen, Bowler, All-rounder, Wk-Batsmen)
6. Runs
7. Balls
8. Wickets
9. Strike Rate

For Calculating Strike Rate:


If the player is a batsmen, then Batting Strike rate = Runs/Balls
If the player is a bowler, then Bowling Strike rate = Wickets/Balls
If the player is an All-rounder, then Strike rate = max(Batting Strike rate, Bowling
Strike rate)

In order to maintain the cricket directory, make a menu driven program and
implement the following functionalities:

● Consider reading/loading entries from .csv file


● Display the directory on the terminal (in a table-like format)
● A user can add a new entry (Strike rate may or may not be given)
● Allow removing and updating entries in the directory
● Search for entries in the directory based on some attribute(s)
● Write back the data in a CSV file
Write the program covering all edge cases that you can identify. Rest all details are
up to you and should be mentioned in the Readme.

Question 3: (30 Marks)


Visualize Data
1.
For this question it is mandatory that you use the library matplotlib and no other
data visualization library. This is an extension of the first 2 questions. The
[Link] you generated in the first question will be used as the base for
creating pie charts here.
A. Pie Chart 1
○ The name of this Pie Chart is “Owes”. You have to create a pie chart
showing the % of money owed by each person.
○ The persons who owe the money (those who have to give the money)
should be the only ones to be involved in the pie chart.
B. Pie Chart 2
○ The name of this Pie Chart is “Gets Back”. You have to create a pie
chart showing the % of money each person will get back.
○ The persons who get back the money (those who are owed the money)
should be the only ones to be involved in the pie chart.
General instructions for the pie chart:
● The legend must show the name and amount of the respective pie chart.
● The pie which has the highest % in the pie chart must “explode”. (See the
Naruto’s and Shikamaru’s pie in the “Owes” chart and Krati’s pie in “Gets
Back” chart)

2.
This part is an extension of the data created in Q-2. You have to create a
comparison histogram for all the players. For example:
For this particular example, there were only 3 players, where Singhal and Kakashi
are all rounders, but Anurag is a bowler only.

Note:
● You have to create histograms based on the player’s role.
● Just show the relevant strike rate and no other data.

Common questions

Powered by AI

Computing strike rates involves distinct calculations tailored to player roles—batting, bowling, or all-round performance. For batsmen, it necessitates dividing the runs by balls faced, and for bowlers, computing wickets per ball. All-rounders require evaluating both and selecting the higher value. These considerations enhance the directory's analytical capabilities by allowing comparisons between players within similar roles and performance evaluation against predefined benchmarks. Precise strike rates provide insights that can guide strategic decisions, such as player selection or role assignments in matches .

A Python-based directory system for managing cricket player entries should include features for loading data from CSVs, dynamic entry addition, and real-time data modification (updates and deletions). Efficiency can be improved by indexing data based on attributes such as player roles for quick retrieval. Crucial functionalities include comprehensive search capabilities, accurate strike rate calculations based on player roles, and robust error handling for edge cases like incomplete data entries. The program should also ensure data integrity during the read/write cycles to a CSV file .

Menu-driven programming enables intuitive navigation and interaction within the cricketer's directory, allowing users to efficiently perform tasks like adding, updating, and removing entries. It impacts user experience positively by providing a structured interface with defined pathways for each operation, reducing the learning curve for new users. The approach also lends scalability to the program, making it adaptable for additional functionalities. However, the complexity of the menu structure should be carefully managed to avoid overwhelming users or causing navigation inefficiencies .

Structuring an expense tracker to export data as CSV enhances its utility by enabling easy data transfer and interoperability with other software applications, such as spreadsheets for further analysis. The CSV format is widely supported and can convene with various data processing tools, making it versatile for users requiring detailed financial audits. Furthermore, exporting in a structured format like CSV aids in long-term data storage and retrieval, providing a clear historical record while facilitating readability across different platforms .

Ensuring a Python project meets specified grading rubrics requires adopting stringent testing strategies to verify logical correctness through various edge cases and typical scenarios. Utilizing development best practices like writing modular code, following PEP 8 for stylistic guidelines, and incorporating comments for clarity enhances code quality and adherence to syntax criteria. Implementing a continuous integration process can also track violations in real-time to ensure each submission phase meets the rubric's expectations. Peer reviews and test-driven development help reinforce logic integrity and identify potential lapses before final submission .

The benefit of using equal distribution for expenses among participants is simplicity; it reduces complexity in calculations and implementation, ensuring that all involved parties pay or receive the same amount, facilitating transparency. However, a drawback includes the lack of flexibility to accommodate scenarios where shared expenses are unequal, such as when participants have different spending capacities or utilization levels. This approach can be perceived as unfair in situations with varied contributions or benefits among participants .

A Python program can ensure data integrity and usability by employing libraries such as csv for reading and writing data. Structuring the program involves defining classes or data structures for cricket players, with methods to handle CSV interactions cleanly. Proper exception handling mechanisms should be in place to manage file I/O errors and data parsing exceptions. Each entry operation should verify data completeness and integrity before writing back to the file. Additionally, maintaining consistent formatting during exports helps in preserving data usability .

Distinguishing features in pie charts, such as 'exploding' the slice with the highest percentage, enhance understanding by visually emphasizing the most significant data points. For financial data, such enhancements can highlight who owes or gets the most money, making it easier to interpret complex datasets at a glance. Customizing legends to include names and specific amounts further clarifies the data, helping to provide a more nuanced understanding of financial distributions and obligations among participants .

Challenges in visualizing financial data using matplotlib can include managing missing or inconsistent data in the CSV files, which could lead to incomplete visual representations. These can be mitigated by pre-processing data to handle missing entries and applying data validation steps prior to visualization. User interface complexity can also challenge interpretation; employing clear labeling, adjusted axes for clarity, and interactive features can enhance user engagement and comprehension. Properly documented legends and annotations can further clarify any complex data patterns presented visually .

When designing a menu-based expense tracker in Python, considerations include ensuring user input validation for unique participant names, numeric values for expenses, and effective parsing of participant lists for expense distribution. Logical edge cases include handling duplicate entries, negative or zero expense amounts, and situations where no participants are added. Addressing these involves implementing checks in the 'Add participant' method to enforce uniqueness and data type validation in the 'Add expense' function. Utilizing Python's exception handling can prevent crashes from invalid inputs .

You might also like