0% found this document useful (0 votes)
4 views18 pages

Practical File (1)

The document contains a series of Python programs that perform various tasks such as calculating the area of a square and circle, determining the day of the week, calculating electricity bills, and generating number tables. Each program is structured with user input and output statements, demonstrating basic programming concepts. The programs also include loops and conditional statements to handle different scenarios.

Uploaded by

aryanmalik.hry
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)
4 views18 pages

Practical File (1)

The document contains a series of Python programs that perform various tasks such as calculating the area of a square and circle, determining the day of the week, calculating electricity bills, and generating number tables. Each program is structured with user input and output statements, demonstrating basic programming concepts. The programs also include loops and conditional statements to handle different scenarios.

Uploaded by

aryanmalik.hry
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/ 18

Practical

File
Bhavya xia
Program 1 Program to find
area of square
import math
a=float(input("enter the number:"))
b=math.pow(a,2)
print("area of square =",b)
Program 2 AREA OF
CIRCLE
import math
r=float(input("enter radius:"))
a=3.14159*math.pow(r,2)
print("area of circle=",a)
Program 3 Day of week
n=int(input("enter the number:"))
if n==1:
print("monday")
elif n==2:
print("tuesday")
elif n==3:
print("wednesday")
elif n==4:
print("thursday")
elif n==5:
print("friday")
elif n==6:
print("saturday")
elif n==7:
print("sunday")
else:
print("invalid response")
Program 4 electricity bill
a=int(input("enter your electricity usage="))
if a<=100:
print("electricity bill=",a*5)
elif 500>=a>100:
print("electricity bill=",a*10)
elif 1000>=a>500:
print("electricity bill=",a*20)
elif a>1000:
print("electricity bill=",a*100)
else:
print("wrong input")
Program 5Exponential of
modulus power
import math
x=int(input("enter a number x"))
y=int(input("enter a number y"))
a=math.exp(math.fabs(x+y))
print(a)
Program 6 Table of
numbers
a= int(input("enter the number whose table you want:"))
for x in range(1,11,1):v
print(a,"X",x,"=",a*x)
Program 7 printing AP
for x in range(1,11,1):
print(x)
Program 8 printing ap
using while loop
x=70
while(x>=7):
print(x)
x=x-7
Program 9 finding sum of
digits till taken number
a=int(input("enter the number whose sum you want to
calculate:"))
z=1
for x in range(1,a,1):
z=z+x
print(z)
Program 10 factorial
a=int(input("enter the number whose sum you want to
calculate:"))
z=1
for x in range(1,a+1,1):
z=z*x
print(z)
Program 11 printing
special series
a=int(input("enter the value of x:"))
y=1
z=1
for x in range(1,6,1):
z=z+(a**x)/x
print(z)
Program 12 to add the
digits of a number
n=int(input("enter the number:"))
y=0
while(n>0):
z=n%10
y=y+z
n=n//10
print(y)
Program 13 printing sum
of all numbers using while loop
x=1
z=0
a=int(input("enter a number of your choice:"))
while(x<=a):
z=z+x
x=x+1
print(z)
Program 14 factorial
using while loop
x=1
z=1
a=int(input("enter a number of your choice:"))
while(x<=a):
z=z*x
x=x+1
print(z)
Program 15 printing GP
x=1
z=int(input("enter the first term:"))
b=int(input("enter the common difference:"))
a=int(input("enter number of terms:"))
print(z)
while(x<a):
z=z*b
print(z)
x=x+1
Program 16 printing a
word in an AP pattern
a=str(input("enter any word:"))
for x in range(1,5,1):
for y in range(1,x+1,1):
print(a,end=" ")
print()

You might also like