??? 2024 1068
??? 2024 1068
SEQUENCE LOGIC
Name - Dona Das
Roll no. - 241001271068
Subject - Tools and Techniques of
Programming
using Python
Subject code - TIU-PCA-L129
Section - 1A
Department - MCA
Semester - 1
Group - 2
𝙰𝚂𝚂𝙸𝙶𝙽𝙼𝙴𝙽𝚃 1
1.To determine the product and average of any two given numbers.
CODE:-
a = float(input("Enter first number :-"))
b = float(input("Enter second number :-")) p =
a*b
g = (a+b)/2
print("The product is {} and average is {}".format(p,g))
OUTPUT:-
2.To determine the simple interest on a given amount of money at a given rate of interest
for a given period of time.
CODE:-
p = float(input("Enter principle :-")) r =
float(input("Enter rate :-"))
print("...Enter time period...")
y = int(input("Enter years :-"))
m = int(input("Enter months :-"))
t = ((y*12)+m)/12
s = (p*r*t)/100
print("The simple interest is Rs. {}".format(s))
OUTPUT:-
3.To determine wage of workers for
certain hours of work at a given hourly
rate.
CODE:-
print("...Enter the time the worker worked...") h =
int(input("Enter hours :-"))
m = int(input("Enter minutes :-"))
r = float(input("Enter hourly rate :-")) t =
((h*60)+m)/60
w = r*t
print("The worked will get a wage of Rs. {}".format(w))
OUTPUT:-
4. To determine the stock value of a store of certain item on the basis of its unit cost and
quantities held in the stock.
CODE:-
u = float(input("Enter unit cost :-"))
q = int(input("Enter quantity :-"))
v = u*q
print("The stock value is {}".format(v))
OUTPUT:-
OUTPUT:-
OUTPUT:-
OUTPUT:-
OUTPUT:-
OUTPUT:-
11. To determine area and perimeter of a square.
CODE:
a = float(input("Enter side length :-"))
p = 4*a
ar = a**2
print("The perimeter of the square is {} units".format(p))
print("The area of the square is {} sq units".format(ar))
OUTPUT:-
OUTPUT:-
13. To determine the acceleration due to gravity on the basis of the effective length of a
simple pendulum.
CODE:
import math
L = float(input("Enter effective length :-"))
T = int(input("Enter time period :-"))
g = 4*((math.atan(1))**2)*L/T
print("The acceleration due to gravity is {}".format(g))
OUTPUT:-
14. To determine the volume a certain mass of gas at a given temperature and pressure
when the volume is known at the normal pressure and at the absolute temperature.
CODE:
P1 = float(input("Enter the initial pressure (in Pascals): "))
V1 = float(input("Enter the initial volume (in cubic meters): "))
T1 = float(input("Enter the initial temperature (in Kelvin): "))
P2 = float(input("Enter the final pressure (in Pascals): "))
T2 = float(input("Enter the final temperature (in Kelvin): "))
V2 = (P1 * V1 * T2) / (P2 * T1)
print(f"the final volume of the gas is {V2} cubic meters")
OUTPUT:-
15. To determine the net salary of an employee when it is known that the employee is
eligible for dearness allowance (DA) of 97% of the basic pay, House Rent Allowance
(HRA) of 57% of the basic pay and medical allowance of Rs.150 . It is further known that
12% of the basic pay is deducted from the gross salary for the Employees Provident fund
(EPF) and Rs. 200 is deducted from the gross pay as the professional tax.
CODE:
basic_pay = float(input("Enter the basic pay of the employee (in Rs.): "))
DA = 0.97 * basic_pay
HRA = 0.57 * basic_pay
medical_allowance = 150
EPF = 0.12 * basic_pay
professional_tax = 200
gross_salary = DA + HRA + medical_allowance + basic_pay
deduction = EPF + professional_tax
net = gross_salary - deduction
print("The net salary is Rs. {}".format(net))
OUTPUT:-