0% found this document useful (0 votes)
5 views21 pages

Console Python Apps: BMI, Tax & More

The document outlines various console-based Python application topics including a BMI Calculator, Parking Fee Calculator, Spiral Printing of Matrices, Digital Calculator, Income Tax Calculation, E-Commerce Order Processing System, Student Academic Performance Management, Inventory Management System, and Bank Account Management System. Each topic includes a description of the application, its purpose, constraints, and examples of input and output. The applications aim to demonstrate programming concepts such as conditional logic, loops, and data structures using Python.

Uploaded by

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

Console Python Apps: BMI, Tax & More

The document outlines various console-based Python application topics including a BMI Calculator, Parking Fee Calculator, Spiral Printing of Matrices, Digital Calculator, Income Tax Calculation, E-Commerce Order Processing System, Student Academic Performance Management, Inventory Management System, and Bank Account Management System. Each topic includes a description of the application, its purpose, constraints, and examples of input and output. The applications aim to demonstrate programming concepts such as conditional logic, loops, and data structures using Python.

Uploaded by

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

Console Based Python Application Topics

Topic-1: BMI Calculator

Body Mass Index (BMI) is a numerical value used to assess whether a person has a healthy
body weight for a given height. It is commonly used in healthcare, fitness applications,
and medical screenings. A BMI Calculator is a console-based real-time application that
takes a person’s height and weight as input and determines their health category.

The BMI Calculator is used to:

 Identify whether a person is underweight, normal, overweight, or obese


 Assist in basic health awareness
 Demonstrate the use of conditional logic in programming
 Apply real-world formulas using Python

Constraints

 Height must be greater than 0


 Weight must be greater than 0
 BMI value should be calculated using float precision
Topic-2: Parking Fee Calculator

A Parking Fee Calculator is a real-time application used in malls, hospitals, offices,


railway stations, and airports to calculate parking charges based on the duration for which
a vehicle is parked. This console-based Python program calculates the total parking fee
using simple rules and basic programming concepts. The Parking Fee Calculator is designed
to:

 Calculate parking charges based on number of hours parked


 Demonstrate the use of conditional statements
 Apply real-life billing logic in programming
 Strengthen understanding of loops, arithmetic operations, and input handling

Parking Fee Rules (Example Guidelines)

Parking Duration Charges

First 1 hour ₹30

Each additional hour or part there of ₹20 per hour

Maximum charge per day ₹200


Topic-3: Spiral Printing and ZigZag of a Square Matrix

a) Spiral printing of a matrix means displaying the elements of a matrix in a clockwise


spiral order, starting from the top-left corner and moving inward layer by layer.

Input Matrix

1 2 3

4 5 6

7 8 9

Output

123698745

b) Zig-zag printing of a matrix means printing the elements of a matrix row by row, but
alternating the direction of printing:

 Even-numbered rows → Left to Right


 Odd-numbered rows → Right to Left

This pattern looks like a zig-zag movement, hence the name.

Input

1 2 3

4 5 6

7 8 9

Output

123654789

147852369
Topic-4: Digital Calculator with Multiple Conversions.

Design a console-based Digital Calculator in Python that allows the user to perform
different types of numerical and unit conversions based on their choice.

The program should display a menu of conversion options, accept the user’s choice, take the
required input value, perform the selected conversion, and display the result.

Conversion Options

1. Decimal to Binary
2. Decimal to Octal
3. Decimal to Hexadecimal
4. Celsius to Fahrenheit
5. Fahrenheit to Celsius
6. Kilometers to Meters
7. Meters to Kilometers
8. Seconds to Minutes and Seconds

Constraints

 User choice must be between 1 and 8


 Input values must be non-negative
 Program should use basic Python constructs only

Example 1

Input

Choice: 1
Value: 10

Output

Binary value: 1010

Topic-5: Income Tax Calculation with Income Heads, Deductions, Surcharge, and Cess.

Design a console-based Python program to calculate the final income tax payable by an
individual by considering:

1. All major heads of income


2. Eligible deductions under different sections
3. Income tax slabs
4. Surcharge (if applicable)
5. Health and Education Cess
The program should compute the gross total income, apply deductions, determine the
taxable income, calculate basic tax, add surcharge, apply cess, and finally display the total
tax payable.

Income Heads to be Considered

1. Income from Salary


2. Income from House Property
3. Income from Business or Profession
4. Income from Capital Gains
5. Income from Other Sources

Deductions to be Considered (Simplified)

Maximum Limit
Section Description
(₹)
80C LIC, PPF, ELSS, etc. 1,50,000
80D Medical Insurance 25,000
80E Education Loan Interest Actual Amount
80TTA Savings Account Interest 10,000

Income Tax Slabs (Simplified)

Taxable Income (₹) Tax Rate


Up to 2,50,000 0%
2,50,001 – 5,00,000 5%
5,00,001 – 10,00,000 20%
Above 10,00,000 30%

Surcharge Rates

Taxable Income (₹) Surcharge


Up to 50,00,000 Nil
50,00,001 – 1,00,00,000 10% of income tax
Above 1,00,00,000 15% of income tax

Health & Education Cess

 4% of (Income Tax + Surcharge)

Input

 Income amounts under each income head


 Deduction amounts under each applicable section
Output

 Gross Total Income


 Total Deductions
 Taxable Income
 Basic Income Tax
 Surcharge Amount
 Health & Education Cess
 Final Tax Payable

Constraints

 All inputs must be non-negative


 Deductions must not exceed prescribed limits
 Ignore rebates and exemptions
 Use basic arithmetic and conditional logic

Example 1

Input

Salary Income: 600000


House Property Income: 100000
Business Income: 0
Capital Gains: 50000
Other Sources: 20000

80C: 150000
80D: 20000
80E: 0
80TTA: 8000
Topic 6:

Advanced Online E-Commerce Order Processing and Billing System

Description

Design a console-based Python program that simulates an online e-commerce platform


from product selection to final checkout.
The system must calculate the final payable amount by considering multiple business rules,
conditions, and constraints similar to real-world e-commerce applications.

Product Catalog

Price
Product ID Product Name Category Stock
(₹)

101 Mobile Phone Electronics 15,000 10

102 Laptop Electronics 55,000 5

103 Headphones Accessories 2,000 20

104 Smart Watch Wearable 3,000 15

105 Keyboard Accessories 1,000 25

Purchase Conditions

1. Quantity ordered must not exceed available stock


2. Minimum quantity allowed per product is 1
3. Maximum quantity allowed per product is 5
4. Same product can be ordered only once per transaction

Discount Rules

Order Value Discount


Order Amount
Discount
(₹)

Below 10,000 No Discount


Order Amount
Discount
(₹)

10,000 – 49,999 10%

50,000 and above 20%

Category-Based Discount

 Accessories → Extra 5% discount


 Maximum total discount allowed → 25%

Coupon Code Rules

Coupon Code Condition Benefit

SAVE100 Order ≥ ₹5,000 Flat ₹100 off

Order ≥
FESTIVE20 Extra 5% off
₹20,000

FREESHIP Order ≥ ₹3,000 Free Delivery

Only one coupon code can be applied per order.

GST Rules

Category GST Rate

Electronics 18%

Wearable 12%

Accessories 5%

GST is calculated after discount and coupon deduction.

Delivery Charges
Final Order Value
Delivery Charge
(₹)

Below 3,000 ₹120

3,000 – 9,999 ₹60

10,000 and above Free

Payment Method Charges

Payment Method Additional Condition Charge

UPI — No charge

Debit Card — No charge

Credit Card Order ≥ ₹10,000 2%

Cash on Delivery Order < ₹50,000 ₹75

User Validation Rules

1. Invalid product ID should be rejected


2. Invalid coupon code should be ignored
3. Negative values are not allowed
4. Order should be cancelled if final payable amount is zero or negative

Input

 Product IDs with quantities


 Coupon code (optional)
 Payment method

Output

 Item-wise price breakdown


 Stock validation result
 Total order amount
 Discounts applied
 Coupon deduction
 GST (category-wise)
 Delivery charge
 Payment method charge
 Final payable amount

Constraints

 Use basic Python concepts only


 Do not use databases or files
 Use conditional statements and loops
 Round final amount to 2 decimal places

Example 1

Input

Products:
Mobile Phone × 1
Headphones × 2

Coupon Code: SAVE100


Payment Method: UPI

Output

Order Amount: ₹19000


Order Discount: ₹1900
Category Discount: ₹100
Coupon Discount: ₹100
GST: ₹2766
Delivery Charge: ₹0
Payment Charge: ₹0
Final Payable Amount: ₹19766

Topic 7 :
Student Academic Performance Management Using Python Dictionary

Problem statement

Create a Python program that manages student academic records using dictionaries. The
program should allow users to:

1. Add student records with subject-wise grades.


2. Update student grades.
3. Delete student records.
4. Display summary reports for all students.
5. Find the top-performing student overall.
6. Find the top student in a specific subject.

All student information should be stored using nested dictionaries, where each student has a
unique roll number, a name, and grades for multiple subjects.

Data Structure

student = {
"roll_no": 101, # Unique integer
"name": "Rakesh", # String
"grades": { # Dictionary of subject: grade
"Math": 85,
"Physics": 78,
"English": 92
}
}

All students are stored in a list of dictionaries:

students = [student1, student2, ...]

Constraints

1. Roll numbers must be unique positive integers.


2. Each student must have at least 3 subjects and at most 8 subjects.
3. Grades must be integers between 0 and 100.
4. Maximum 50 students can be stored.
5. Updating grades requires the subject to exist for that student.
6. Deleting requires a valid roll number.
7. If multiple students have the same highest average, display all of them.
8. Negative values are not allowed.
Input / Output

Adding Students

Input

Add Student:
Name: Rakesh
Roll No: 101
Grades: {"Math": 85, "Physics": 78, "English": 92}

Add Student:
Name: Priya
Roll No: 102
Grades: {"Math": 90, "Physics": 82, "English": 88}

Output

Student Summary Report:


Roll No: 101, Name: Rakesh, Grades: {'Math': 85, 'Physics':
78, 'English': 92}, Average: 85.0
Roll No: 102, Name: Priya, Grades: {'Math': 90, 'Physics': 82,
'English': 88}, Average: 86.7

Top-Performing Student Overall: Priya (Average: 86.7)

Updating Grades

Input

Roll No: 101


Subject: Physics
New Grade: 80

Output

Updated Grades for Roll No 101:


{'Math': 85, 'Physics': 80, 'English': 92}

Deleting a Student

Input

Roll No: 102

Output

Student with Roll No 102 deleted successfully.


Finding Top Student in a Subject

Input

Subject: Math

Output

Top Student in Math: Priya (Grade: 90)

Invalid Input Example

Input

Add Student:
Roll No: 101

Output

Error - Roll number already exists.


Topic 8 :

Inventory Management System Using Python Dictionary

Problem Statement

Design a console-based Python program to manage a store inventory using dictionaries.

The system should allow the user to:

1. Add new products to inventory.


2. Update product details (price, quantity).
3. Delete products from inventory.
4. Search for a product by name or product ID.
5. Display a summary report of all products.
6. Calculate the total inventory value (sum of price × quantity for all
products).

All product information should be stored using Python dictionaries, and the inventory can
be stored as a dictionary of dictionaries, with product ID as key.

Data Structure

inventory = {
101: {
"name": "Mobile Phone",
"category": "Electronics",
"price": 15000,
"quantity": 10
},
102: {
"name": "Laptop",
"category": "Electronics",
"price": 55000,
"quantity": 5
}
}

Constraints

1. Product ID must be unique and positive.


2. Product name should be a non-empty string.
3. Price must be a positive integer.
4. Quantity must be a non-negative integer.
5. Maximum products allowed: 100.
6. Updating requires a valid product ID.
7. Deleting requires a valid product ID.
8. Searching can be done by product ID or name.
9. Total inventory value must be calculated correctly using price × quantity.
10. System should handle invalid input gracefully.

Operations / Input

1. Add Product
o Input: Product ID, Name, Category, Price, Quantity
o Output: Confirmation of product addition
2. Update Product
o Input: Product ID, New Price, New Quantity
o Output: Updated product details
3. Delete Product
o Input: Product ID
o Output: Confirmation of deletion
4. Search Product
o Input: Product ID or Name
o Output: Product details
5. Display Summary Report
o Output: List of all products with ID, Name, Category, Price, Quantity
6. Calculate Total Inventory Value
o Output: Sum of price × quantity for all products

Example 1 – Adding Products

Input

Add Product:
ID: 101
Name: Mobile Phone
Category: Electronics
Price: 15000
Quantity: 10

Add Product:
ID: 102
Name: Laptop
Category: Electronics
Price: 55000
Quantity: 5

Output

Product 101 added successfully.


Product 102 added successfully.

Topic 9 :

Problem Statement

Bank Account Management System Using Python Dictionary

Description

Design a console-based Python program to manage bank accounts using Python


dictionaries.

The system should allow a bank to manage multiple accounts, perform transactions, and
track balances. Users (bank staff or customers) should be able to:

1. Create new accounts


2. Update account details
3. Deposit money
4. Withdraw money
5. Check balance
6. Transfer money between accounts
7. Display a summary of all accounts

All account information should be stored using nested dictionaries, where each account has
a unique account number, customer name, account type, and balance.

Data Structure

Each bank account is represented as a dictionary:

account = {
"account_no": 101,
"name": "Rakesh Verma",
"account_type": "Savings", # Savings / Current
"balance": 50000
}

All accounts are stored in a dictionary of dictionaries, using account number as the key:

bank_accounts = {
101: {"name": "Rakesh Verma", "account_type": "Savings",
"balance": 50000},
102: {"name": "Priya Sharma", "account_type": "Current",
"balance": 75000}
}
Constraints / Business Rules

1. Account Number: Must be unique positive integer.


2. Name: Must be a non-empty string.
3. Account Type: Only "Savings" or "Current" allowed.
4. Minimum Balance:
o Savings: ₹1,000
o Current: ₹5,000
5. Deposit Amount: Must be positive integer.
6. Withdrawal Amount: Cannot exceed current balance minus minimum balance.
7. Money Transfer: Cannot transfer more than available balance minus minimum
balance.
8. Maximum Accounts: 100 accounts can be created.
9. Invalid Inputs: Negative amounts, invalid account numbers, or invalid account types
should be rejected.
10. Display: All monetary values must be rounded to 2 decimal places.

Operations / Input

1. Create Account
o Input: Account Number, Name, Account Type, Initial Deposit
o Output: Confirmation message
2. Update Account
o Input: Account Number, New Name, New Account Type
o Output: Updated account details
3. Deposit Money
o Input: Account Number, Deposit Amount
o Output: Updated Balance
4. Withdraw Money
o Input: Account Number, Withdrawal Amount
o Output: Updated Balance or Error if insufficient balance
5. Check Balance
o Input: Account Number
o Output: Current Balance
6. Transfer Money
o Input: Source Account Number, Target Account Number, Amount
o Output: Updated Balances or Error if insufficient balance
7. Display Summary Report
o Output: List all accounts with Account No, Name, Type, Balance
Example 1 – Create Accounts

Input

Create Account:
Account No: 101
Name: Rakesh Verma
Account Type: Savings
Initial Deposit: 20000

Create Account:
Account No: 102
Name: Priya Sharma
Account Type: Current
Initial Deposit: 50000

Output

Account 101 created successfully.


Account 102 created successfully.

Example 2 – Deposit Money

Input

Deposit:
Account No: 101
Amount: 5000

Output

Deposit successful. Updated Balance: ₹25000

Example 3 – Withdraw Money

Input

Withdraw:
Account No: 102
Amount: 48000

Output

Error: Insufficient balance. Minimum balance ₹5000 must be


maintained.
Topic 10 :

Problem Statement

College Attendance Tracker Using Python Dictionary

Description

Design a console-based Python program to manage student attendance in a college using


Python dictionaries.

The system should allow:

1. Adding student records with subject-wise attendance.


2. Updating attendance for individual subjects.
3. Deleting student records.
4. Calculating attendance percentage per student.
5. Identifying students with low attendance (e.g., below 75%).
6. Generating a complete attendance report.

This simulates a real-life college attendance management system.

2. Data Structure

Each student is represented as a dictionary:

student = {
"student_id": 101, # Unique integer
"name": "Rakesh Verma", # String
"class": "CS101", # Class/Section
"attendance": { # Subject-wise days attended
"Math": 20,
"Physics": 18,
"English": 22
}
}

All students are stored in a list of dictionaries:

students = [student1, student2, ...]

Additionally, the total number of classes conducted per subject should be stored in a
dictionary:

total_classes = {
"Math": 25,
"Physics": 25,
"English": 25
}

3. Functional Requirements

1. Add Student Record


o Input: Student ID, Name, Class, Subject-wise attendance
o Output: Confirmation of record addition
2. Update Attendance
o Input: Student ID, Subject, New Attendance
o Output: Updated attendance record
3. Delete Student Record
o Input: Student ID
o Output: Confirmation of deletion
4. Calculate Attendance Percentage
o For each subject: (Days Attended / Total Classes) × 100
o Overall attendance = Average of all subjects
5. Identify Low Attendance Students
o Students with overall attendance < 75%
o Output: List of student IDs and names
6. Display Attendance Report
o Output: Student ID, Name, Class, Subject-wise attendance, Overall percentage

4. Constraints

1. Student ID: Must be unique positive integer.


2. Attendance: Must be ≤ total classes conducted for that subject.
3. Minimum Subjects: Each student must have at least 3 subjects.
4. Maximum Subjects: Maximum 8 subjects per student.
5. Negative Values: Not allowed for attendance or student ID.
6. Maximum Students: System should handle up to 100 students.
7. Validation:
o Updating attendance requires existing student and subject
o Deleting requires valid student ID
o Adding a student with duplicate ID is not allowed
8. Rounding: Attendance percentages should be rounded to 2 decimal places.

Example 1 – Adding Students

Input
Add Student:
ID: 101
Name: Rakesh Verma
Class: CS101
Attendance: {"Math": 20, "Physics": 18, "English": 22}

Add Student:
ID: 102
Name: Priya Sharma
Class: CS101
Attendance: {"Math": 22, "Physics": 20, "English": 23}

Output

Student 101 added successfully.


Student 102 added successfully.

Example 2 – Update Attendance

Input

Update Attendance:
Student ID: 101
Subject: Physics
New Attendance: 21

Output

Attendance updated for Student 101:


{'Math': 20, 'Physics': 21, 'English': 22}

Example 3 – Calculate Attendance Percentage

Input

Calculate Attendance Percentage:


Student ID: 101

Output

Math: 80.0%
Physics: 84.0%
English: 88.0%
Overall Attendance: 84.0%

Example 4 – Identify Low Attendance Students

Input

Threshold: 75%

Output

Students with low attendance:


Student ID: 103, Name: Rahul Verma, Overall Attendance: 72.5%
Student ID: 105, Name: Simran Kaur, Overall Attendance: 70.0%

Common questions

Powered by AI

In an e-commerce order processing system, operational constraints and rules include product stock validation, where quantity ordered must not exceed available stock and is limited to 1-5 per product . Discount rules apply based on order value, with additional category-specific discounts and a maximum overall discount cap of 25% . Coupon codes, when applicable, provide specific benefits but only one can be applied per order . GST rates vary by product category and are calculated after discounts . Payment method choices can incur additional charges depending on conditions . Finally, the program should reject invalid product IDs, coupon codes, and handle negative values safely, ensuring compliance with these constraints throughout the transaction processing .

A BMI Calculator contributes to health awareness by providing users a straightforward way to assess whether they are underweight, normal, overweight, or obese based on their height and weight . This tool helps individuals understand their body health status and guides them in making informed health-related decisions. It demonstrates key programming concepts such as applying real-world formulas, using conditional logic to determine health categories, and handling input validation, as height and weight must be greater than 0 and the BMI value requires float precision .

The Digital Calculator is designed to enable accurate conversions by offering a menu-driven interface where users can select from various conversion options such as Decimal to Binary, Octal, Hexadecimal, Celsius to Fahrenheit, and more . The program captures the user's choice and input values, performs the computation using appropriate conversion formulas, and outputs the result. Constraints ensuring reliability include user choice limitation to options 1-8, non-negative input values, and the use of only basic Python constructs. These constraints prevent erroneous entries and ensure smooth execution of the conversion processes .

Managing student records involves several operations facilitated by using nested dictionaries within Python. Each student is represented as a dictionary containing their roll number, name, and grades for multiple subjects . The primary data structure, a list of these student dictionaries, allows operations such as adding new students, updating grades, deleting records, finding top performers, and displaying summary reports. Uniqueness of roll numbers is crucial to ensure integrity . The operations are further supported by constraints such as positive unique roll numbers, compulsory grade entries for at least three subjects, and the use of safe data handling techniques to maintain robust record management .

Designing a console-based parking fee calculator involves setting a clear fee structure and programming logic. The fee structure specifies an initial charge of ₹30 for the first hour, followed by ₹20 for each subsequent hour or part thereof, with a maximum daily charge capped at ₹200 . The programming logic employs conditional statements to apply these rules effectively, handling hour increments and ensuring accurate fee computation based on total hours parked. Input validation is crucial to handle real-time data entry without errors, and the use of loops may streamline the iterative processing of hours and fee calculations .

Bank account management using Python dictionaries is regulated through business rules that ensure proper handling of deposit and withdrawal operations. Deposits must be positive integers, maintaining account balance integrity . Withdrawal operations cannot draw the balance below the minimum required balance, which is ₹1,000 for savings accounts and ₹5,000 for current accounts, ensuring financial stability and regulatory compliance . Additionally, money transfers are subject to the same minimum balance rule, and any transaction exceeding these bounds is rejected with an error message. This regulatory framework ensures secure and responsible financial management in the system .

The income tax calculator uses defined tax slabs to determine an individual's total tax liability, with no tax imposed on incomes up to ₹2,50,000, followed by rates of 5%, 20%, and 30% for larger taxable amounts . Eligible deductions like those under section 80C (capped at ₹150,000) and others reduce taxable income before applying these rates. The system also considers surcharges for incomes over ₹50,00,000 and imposes a Health & Education Cess of 4% . Constraints include ensuring inputs are non-negative, adhering to deduction limits, and ignoring complex rebates and exemptions, focusing solely on straightforward arithmetic and conditional processing .

Overall attendance percentage is calculated by first determining the attendance percentage for each subject, which is the number of days attended divided by the total number of classes conducted, multiplied by 100 . The overall attendance is then the average of these percentages across all subjects . To ensure accuracy, constraints such as a requirement for attendance to not exceed total classes conducted, a minimum of three subjects per student, and rounding of percentages to two decimal places are enforced . Negative values are prohibited, and each student ID must be unique. These constraints maintain the system's integrity and reliability .

To calculate the final tax payable using a console-based Python program, the process begins with computing the gross total income by summing all income heads, including salary, house property, business income, capital gains, and other sources . Eligible deductions are applied under sections like 80C (up to ₹150,000), 80D, 80E, and 80TTA, which reduce the gross total income to a taxable income . Taxable income is assessed against simplified tax slabs: 0% for up to ₹2,50,000, 5% for income between ₹2,50,001 and ₹5,00,000, 20% for ₹5,00,001 to ₹10,00,000, and 30% for income above ₹10,00,000 . A surcharge applies to higher taxable incomes, and a 4% Health and Education Cess is added on the combination of income tax and surcharge. The program outputs detailed components like gross income, deductions, basic tax, surcharge, and the final tax payable .

Spiral and zig-zag printing of matrices showcase programming logic through specific traversal methods applied to a matrix. Spiral printing requires visiting matrix elements in a clockwise spiral, starting from the top-left and moving inward layer by layer, which demands careful management of indices and directional changes . Zig-zag printing involves alternating row traversal directions, moving left to right on even rows and right to left on odd rows, presenting the challenge of correctly managing row indices and ensuring consistent element ordering . Both require a deep understanding of matrix properties, precise index handling, and effective use of loops and conditional logic to achieve the desired output, demonstrating complex problem-solving in programming .

You might also like