B 2 Pps Lab Assignment 1
B 2 Pps Lab Assignment 1
01
Title:
To calculate salary of an employee given his basic pay (take as input from user). Calculate salary of
employee. Let HRA be 10 % of basic pay and TA be 5% of basic pay. Let employee pay professional
tax as 2% of total salary. Calculate salary payable after deductions.
Objective:
Understand basic concepts of programming language and try to solve mathematical calculations in
programming approach with the help of formulas and equations.
Problem Statement:
Outcomes:
1. Learner will be able to demonstrate calculations of employee salary.
2. Learner will be able to demonstrate different Operator & formulas on available data of employee
salary
3. Learner will be able to demonstrate python implementation to calculate salary of an employee.
Hardware Requirement: Any CPU with i3 Processor or similar, 1 GB RAM or more,2 GB Hard
Disk or more.
Software Requirements: 32/64 bit Linux(Ubuntu/Fedora)Operating System, latest any Python Tool
Like Anaconda,Pycharm, Python IDLE, Python Atom, Eclipse.
Theory:
Python Basics:
Python is an interpreted, high-level, general-purpose programming language. Created by Guido van
Rossum and first released in 1991, Python's design philosophy emphasizes code readability with its
notable use of significant whitespace. The language places strong emphasis on code reliability and
simplicity so that the programmers can develop applications rapidly.
Python is Simple, Easy to learn, Versatile, Free and open source, High level language, Interactive,
Portable, Object oriented, Interpreted, Dynamic and Extensible.
Data types in Python
Every value in Python has a datatype. Since everything is an object in Python programming, data
types are classes and variables are instance (object) of these classes. There are various data types in
Python. Some of the important types are Numbers (Integer, float, complex etc.), Boolean, string, list,
tuple, dictionary, set etc.
Python provides numerous built-in functions that are readily available to us at the Python prompt.
Some of the functions like input() and print() are widely used for standard input and output operations
respectively. To allow flexibility, we might want to take the input from the user. input() function is
used to take input into a program from console.
The syntax for input() is:
input([prompt]) where prompt is the string we wish to display on the
screen and It is optional The print() function prints the given object to the
standard output device (screen) or to the text stream file. The general format
used for print() is:
print(*objects, sep = 'separator') where objects is object to the printed and * indicates that there
may be more than one object and sep is objects are separated by sep. Default value ‘ ‘.
An operator is a symbol that performs an operation. They are used to perform operations on variables
and values. In Python operators are categorized in the following groups:
1.Arithmetic Operators
2.Relational Operators / Comparison Operators
3.Logical Operators
4.Assignment Operators
5.Bitwise Operators
6.Membership Operators
7.Identity Operators What is
Basic salary?
Basic salary is the base income of an individual. It is a fixed part of one's compensation package. A
basic salary depends on the employee’s designation and the industry in which the employee works.
Basic salary is the amount paid to an employee before any extras are added or taken off, such as
reductions because of salary sacrifice schemes or an increase due to overtime or a bonus. Allowances,
such as internet for home-based workers or contributions to phone usage, would also be added to the
basic salary.
Gross salary is the amount calculated by adding up one's basic salary and allowances before
deduction of taxes and other deductions. It includes bonuses, over-time pay, holiday pay, and other
differentials.
Gross Salary = Basic Salary + HRA + Other Allowances
An allowance is an amount received by the employee for meeting service requirements. Allowances
are provided in addition to the basic salary and vary from company to company. Some common types
of allowances are shown below:
• HRA or House Rent Allowance: It is an amount paid out to employees by companies for
expenses related to rented accommodation.
• Leave Travel Allowance (LTA): LTA is the amount provided by the company to cover
domestic travel expenses of an employee. It does not include the expenses for food,
accommodation, etc. during the travel.
• Other such allowances are the special allowance, medical allowance, incentives, etc.
HRA received is not fully exempt from tax. HRA that you can claim is the lowest of the following:
• The total amount received as the HRA from the employer in the financial year.
• Actual rent paid in the year – 10% of the basic salary in the year.
• 50% of the annual basic salary if staying in a metro city or 40% of the annual basic salary if
staying in a non-metro city.
Program:
Output:
Conclusion:
Thus, we have successfully understood fundamental concepts of python and salary calculation
formulas and performed salary calculation in python.