0% found this document useful (0 votes)
32 views

experiment 2 python

The document outlines an academic assignment for a Python programming course, detailing two experiments focused on operators, expressions, and input-output statements. The first experiment involves calculating the gross salary of an employee based on user input for basic salary, while the second explores basic arithmetic operations with user-provided numbers. The conclusion indicates that the student has understood the concepts demonstrated in the programs.
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)
32 views

experiment 2 python

The document outlines an academic assignment for a Python programming course, detailing two experiments focused on operators, expressions, and input-output statements. The first experiment involves calculating the gross salary of an employee based on user input for basic salary, while the second explores basic arithmetic operations with user-provided numbers. The conclusion indicates that the student has understood the concepts demonstrated in the programs.
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
You are on page 1/ 3

Department of Humanities and Applied Science

Academic Year: 2024-25 Name of Student:Abhishek Pal


Semester: II Student ID:24107084
Class / Branch: F.E Div I1 Date of Performance:22/01/2024
Subject: Python Programming Date of Submission:08/02/2024
Name of Instructor: Prof. Pravin SIR
Experiment No.2

Problem: Write python programs to understand Operators, expressions, and Input Output Statements.

Problem Statement:
1. Calculating Gross Salary of an Employee*:
Write a Python program to calculate the gross salary of an employee.
The program should prompt the user for the basic salary (BS) and then compute the dearness allowance (DA)
as 70% of BS, the travel allowance (TA) as 30% of BS, and the house rent allowance (HRA) as 10% of BS.
Finally, it should calculate the gross salary as the sum of BS, DA, TA, and HRA and display the result.

program code:

Basic = int(input("Enter base salary: "))

HRA = (Basic/100)*30

DA = (Basic/100)*70

TA = (Basic/100)*15

GCC = Basic + HRA + DA + TA

print("Gross value is : ",GCC)

Output:
. 2. Exploring Basic Arithmetic Operations in Python*:
Write a Python program to explore basic arithmetic operations.
The program should prompt the user to enter two numbers and then perform addition, subtraction,
multiplication, division, and modulus operations on those numbers. The results of each operation should be
displayed to the user.

Program code:

x = int(input("Enter a value:"))

y = int(input("Enter a value:"))

a = x+y

print("Addition is:",a)

b = x-y

print("subtraction is:",b)

c = x*y

print("multiplication is :",c)

d = x/y

print("division is:",d)

e = x%y

print("modulus is:",e)
output:

Conclusion: Understood the programs demonstrating the use of operators, expressions, and input-output
statements in Python.

You might also like