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

PythonPrgGrade9-solution

Uploaded by

bhuwye
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

PythonPrgGrade9-solution

Uploaded by

bhuwye
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

#1.To print personal information like Name, Father’s Name, Class, School Name.

print("Name : ..........")
print("Father's Name : ...............")
print("Class : ...............")
print("School Name : ...............")

/*2.To print the following patterns using multiple print commands-


*
**
***
****
*****

*/

print("*")
print("**")
print("***")
print("****")
print("*****")

#3.To find square of number 7

Square=7*7
print(Square)

#4.To find the sum of two numbers 15 and 20.

a=20
b=15
Sum=a+b
print(Sum)

#5.To convert length given in kilometers into meters.

km=int(input("Enter value:"))
m=km*1000
print(m)

#6.To print the table of 5 up to five terms.

for i in range(1,6):
print(5*i)

#7.To calculate Simple Interest if the principle_amount = 2000 rate_of_interest =


4.5 time = 10

P=2000
R=4.5
T=10
SI=P*R*T/100
print(SI)

#6.To calculate Area and Perimeter of a rectangle

L=int(input("enter value"))
B=int(input("enter value"))
Area=L*B
Perimeter=2*(L+B)
print(Area)
print(Perimeter)

#7.To calculate Area of a triangle with Base and Height

Base=int(input("enter value:"))
Hieght=int(input("enter value:"))

Area=1/2*Base*Hieght
print(Area)

#8.To calculating average marks of 3 subjects

S1=int(input("Enter Subject1 marks :"))


S2=int(input("Enter Subject2 marks :"))
S3=int(input("Enter Subject3 marks :"))
avg=(S1+S2+S3)/3
print("Average marks are :", avg)

#9.To calculate discounted amount with discount %

CP=int(input("Enter value"))
D=int(input("Enter discount percentage"))
discount=CP/100*D
print("Discounted amount is ", discount)

#10.To calculate Surface Area and Volume of a Cuboid

L=int(input("Enter value:"))
B=int(input("Enter value:"))
H=int(input("Enter value:"))

Area=2*(L*B+B*H+L*H)
print(Area)

#11.Program to check if a person can vote

Age=int(input("Enter age"))
if(Age>=18):
print("you are eligible to vote")
else :
print("you are not eligible to vote ")
'''12.To check the grade of a student.Criteria as follows:
90+ - A
80-89 - B
70-79 - C
60-69 - D
50-59 - E
Below 50 - Fail''

p=int(input("Enter percentage"))
if(p>=90):
print("A Grade")
elif(p>=80 and p<=89):
print("B Grade")
elif(p>=70 and p<=79):
print("C Grade")
elif(p>=60 and p<=69):
print("D Grade")
elif(p>=50 and p<=59):
print("E Grade")
else:
print("Fail")

#13.Input a number and check if the number is positive, negative or zero and
display an appropriate message

n=int(input("Enter number"))
if(n>0):
print("It is positive number")
elif(n<0):
print("It is negative number")
else:
print("It is zero")

#14.To print first 10 natural numbers

for i in range(1,11,1):
print(i)

#15.To print first 10 even numbers

for i in range(2,21,2):
print(i)

#16.To print odd numbers from 1 to n

n=int(input("Enter value:"))
for i in range(1,n,2):
print(i)

#17.To print sum of first 10 natural numbers

Sum=0
for i in range(1,11,1):
Sum=Sum+i
print(Sum)

You might also like