0% found this document useful (0 votes)
23 views16 pages

Ilovepdf Merged

The document contains a series of Python programs that demonstrate various functionalities, including calculating total marks and percentage, finding the square of a number's last digit, and determining the average and grade based on marks. Other programs cover topics such as calculating sell price after discount, perimeter and area of shapes, simple and compound interest, and identifying the largest and smallest numbers in a list. Each program includes input prompts and corresponding output statements.

Uploaded by

Sameer Bhandari
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)
23 views16 pages

Ilovepdf Merged

The document contains a series of Python programs that demonstrate various functionalities, including calculating total marks and percentage, finding the square of a number's last digit, and determining the average and grade based on marks. Other programs cover topics such as calculating sell price after discount, perimeter and area of shapes, simple and compound interest, and identifying the largest and smallest numbers in a list. Each program includes input prompts and corresponding output statements.

Uploaded by

Sameer Bhandari
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/ 16

# PROGRAM 1 – WRITE A PYHTON CODE THAT ACCEPT YOUR ROLL NO.

NAME AND MARKS


OF 5 SUBJECTS AS INPUT AND THEN PRINT ALL THE DETAILS INCLUDING TOTAL MARKS AND
PERCENTAGE.

INPUT –

name=input("Enter your name ")

roll_no=int(input("Enter your roll no"))

p=int(input("Enter your physics marks "))

c=int(input("Enter your chemistry marks"))

m=int(input("Enter your mathematics marks"))

e=int(input("Enter your english marks"))

i=int(input("Enter your IP marks"))

t=p+c+m+e+i

print("total marks =",t)

q=t/5

print("percentage =",q)

OUTPUT –
# PROGRAM 2 – WRITE THE PYTHON CODE THAT ACCEPT AN INTEGER NO. FROM THE USER
AND THEN PRINT THE SQUARE OF ITS LAST DIGIT.

INPUT –

a=int(input("Enter a two digit no"))

b=a%10

c=b**2

print("the square of the last digit =",c)

OUTPUT –
# PROGRAM 3 – WRITE A PYTHON CODE THAT ACCEPT A TWO DIGIT INTEGER NO. FROM THE
USER AND THEN PRINT THE SUM AND PRODUCT OF ITS DIGITS.

INPUT –

a=int(input("Enter the two digit no"))

b=a%10

c=a//10

d=b+c

e=b*c

print("The sum of the two digits integer =",d)

print("The product of the two digit integer =",e)

OUTPUT –
# PROGRAM 4 – TO FIND AVERAGE AND GRADE FOR THE GIVEN MARKS.

INPUT –

p=int(input("Enter your physics marks"))

c=int(input("Enter your chemistry marks"))

m=int(input("Enter your mathematics marks"))

e=int(input("Enter your english marks"))

i=int(input("Enter your IP marks"))

a=p+c+m+e+i

b=a/5

print("The average marks =",b)

if (b>=90):

print("Student passed with A")

elif (80<=b<90):

print("Student passed with B")

elif (70<=b<80):

print("Student passed with C")

else:

print("Student passed with D")

OUTPUT –
# PROGRAM 5 – TO FIND THE SELL PRICE OF AN ITEM WITH GIVEN COST AND DISCOUNT(%).

INPUT –

a=int(input("Enter the cost of an item"))

b=int(input("Enter the discount % to an item"))

c=b/100*a

d=a-c

print("sell price of an item after discount =",d)

OUTPUT –
# PROGRAM 6 – TO CALCULATE THE PERIMETER/ CIRCUMFERENCE AND AREA OF THE
SHAPES SUCH AS TRIANGLE, RECTANGLE AND CIRCLE.

INPUT –

# TRIANGLE

a=int(input("Enter the height of triangle "))

b=int(input("Enter the base of triangle"))

c=int(input("Enter the third side of triangle"))

d=0.5*a*b

print("The area of triangle =",d)

e=a+b+c

print("The perimeter of triangle =",e)

# RECTANGLE

f=int(input("Enter the length of rectangle "))

g=int(input("Enter the width of the rectangle"))

h=f*g

print("The area of rectange =",h)

i=2*(f+g)

print("The perimeter of rectangle =",i)

# CIRCLE

j=int(input("Enter the radius of the circle"))

k=3.14*j**2

print("The area of circle =",k)

l=2*3.14*j

print("The circumference of the circle =",l)


OUTPUT –
# PROGRAM 7 – TO CALCULATE SIMPLE INTEREST AND COMPOUND INTEREST

INPUT –

a=int(input("Enter the principal balance"))

b=int(input("Enter the interest rate"))

c=int(input("Enter the time period"))

d=a*b*c/100

print("The simple interest =",d)

e=int(input("Enter the no. of time interest applied"))

f=a*(1+b/e)**c

print("The compound interest =",f)

OUTPUT –
# PROGRAM 8 – TO FIND LARGEST AND SMALLEST NO. IN THE LIST.

INPUT –
a=(12,13,14,15)
b=max(a)
c=min(a)
print("The largest no. of the list :",b)
print("The smallest no. of the list :",c)

OUTPUT –
# PROGRAM 9 – TO FIND SUM OF SQUARES OF FIRST 100 NATURAL NO.

INPUT –
b=0
for n in range(1,101):
b +=n**2
print("The sum of square of first 100 natural no. =",b)

OUTPUT –
#PROGRAM 10 – TO COUNT NO. OF VOWELS IN USER ENTERED.

INPUT –
b=0
a=input("Enter the string :")
for char in a:
if char in "aeiouAEIOU":
b +=1
print(“The no. of vowels in “,a,”is”,b)

OUTPUT –
# PROGRAM 11 – TO PRINT WORD STARTING WITH ‘a’ ALPHABET.

INPUT –
a=int(input("Enter the pricipal balance:"))
b=int(input("Enter the interest rate:"))
c=int(input("Enter the load tenture in months:"))
d=a*b*(1+b)**c
e=(1+b)**c-1
f=d/e
print("Your EMI is :",f)

OUTPUT –
# PROGRAM 12 – TO CALCULATE PROFIT, LOSS FOR GIVEN COST AND SELL PRICE.

INPUT –
a=int(input("Enter the cost price of an item"))
b=int(input("Enter the sell price of an item"))
if b<a:
print("Item sold in loss")
else:
print("Item sold in profit")

OUTPUT –
# PROGRAM 13 – TO PRINT THE FIRST “N” MULTIPLES OF GIVEN NO.

INPUT –
number = int(input("Enter the number: "))
n = int(input("Enter how many multiples you want: "))
print(f"The first {n} multiples of {number} are:")
for i in range(1, n + 1):
print("{number} x {i} = {number * i}")

OUTPUT –
PROGRAM 14 – TO PRINT THAT A NO. GIVEN BY USER IN ODD OR EVEN.

INPUT –
n=int(input(“Enter a number”))
if n%2==0:
print(“It is an even no.”)
else:
print(“It is an even no.”)

OUTPUT –
#PROGRAM 15 – TO PRINT THAT A NUMBER ENTER BY USER IS EITHER POSITIVE
OR NEGATIVE.

INPUT -
n=int(input(“Enter the number”))
if n>0
print(“It is positive no.”)
elif n<0
print(“It is a negative no.”)
else:
print(“Neither positive nor negative”)

OUTPUT –

You might also like