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

??? 2024 1068

Uploaded by

asif17111998
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 views8 pages

??? 2024 1068

Uploaded by

asif17111998
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
You are on page 1/ 8

Python Assignment

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:-

5. To determine the remainder when one


number is divided by another number.
CODE:-
dividend = int(input("Enter dividend :-"))
divisor = int(input("Enter divisor :-"))
rem = dividend % divisor
print("The remainder is {}".format(rem))
OUTPUT:-

6. To determine the value of an


exponential expression of the form ab on
the basis of a given base and the power
to be raised.
CODE:-
a = int(input("Enter the value :-"))
b = int(input("Enter the power :-"))
print("{} raise to the power {} is
{}.".format(a,b,a**b))

OUTPUT:-

7. To determine the area of a


parallelogram. CODE:-
b = float(input("Enter base length :-")) h =
float(input("Enter height length :-"))
print("The area of parallelogram is {} sq units".format(b*h))

OUTPUT:-

8. To determine the area of the walls of a


rectangular room and hence the cost of
its painting on the basis of charge per
square unit.
CODE:-
l = float(input("Enter length :-"))
b = float(input("Enter breadth :-"))
h = float(input("Enter height :-"))
print("The area of 4 walls is {} sq
units".format(0.5*(l+b)*h))
c = float(input("Enter cost of painting per unit
area :-"))
print("The cost of painting is Rs.
{}".format(0.5*(l+b)*h*c))

OUTPUT:-

9. To determine the area of a cone.


CODE:
import math
d = float(input("Enter diameter :-"))
r = d/2
h = float(input("Enter height of cone :-"))
l = math.sqrt(h**2 + r**2)
area = 4*math.atan(1)*r*l
print("The area of the cone is {} square units".format(area))

OUTPUT:-

10. To determine the perimeter of the triangular plot.


CODE:
a = float(input("Enter first length :-"))
b = float(input("Enter second length :-"))
c = float(input("Enter third length :-"))
p = a+b+c
print("The perimeter of the triangular plot is {} units".format(p))

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:-

12. To determine the miles on the basis of given kilometers.


CODE:
k = float(input("Enter kilometers :-"))
m = 0.621*k
print("The given kilometers are {} miles".format(m))

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:-

You might also like