0% found this document useful (0 votes)
6 views2 pages

Class x Python Prg s

The document contains a series of Python programming exercises aimed at Class X students, covering various topics such as calculating volume and surface area of a cuboid, converting height from centimeters to feet and inches, and using Heron's formula for triangle area. Additional exercises include calculating profit or loss, checking for specific colors, determining eligibility for a roller coaster ride, and working with numbers to find sums, products, and averages. The document also includes programs for checking Armstrong numbers, summing a series, and managing a list of students by roll number.

Uploaded by

Gunjan Singhal
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)
6 views2 pages

Class x Python Prg s

The document contains a series of Python programming exercises aimed at Class X students, covering various topics such as calculating volume and surface area of a cuboid, converting height from centimeters to feet and inches, and using Heron's formula for triangle area. Additional exercises include calculating profit or loss, checking for specific colors, determining eligibility for a roller coaster ride, and working with numbers to find sums, products, and averages. The document also includes programs for checking Armstrong numbers, summing a series, and managing a list of students by roll number.

Uploaded by

Gunjan Singhal
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/ 2

Class X: ARTIFICIAL INTELLIGENCE

Advanced Python
Prg1. Write a program to calculate Volume and Surface Area of a Cuboid.
Hint:
Volume of cuboid=l*w*h
SurfcAr of cuboid= 2*(l*w +l *h+ w*h)

L= int(input(“Enter Length of Cuboid \t:\t” ))


W= int(input(“Enter Width of Cuboid \t:\t” ))
H= int(input(“Enter Height of Cuboid \t:\t” ))

VC= L*W*H
print(“Volume of Given Cuboid = ”, VC)
SA=2*(L*W + L*H + W*H)
print(“Surface Area of Given Cuboid =” , SA)

Prg 2. Write a program to ask for height in centimetres and convert it into feet and inches.
Hcms= float(input(“Enter your height in centimetres :\t ”))
Hinch = Hcms/2.54
Hfeet = Hinch // 12
Inch = Hinch % 12

print(“Your height is ”, Hfeet, “ Feet” , Inch, “ inches”)

Prg3. Write a Python program to calculate the area of triangle using Heron’s formula.
Hint: s=(a+b+c)/2. Ar=sqrt of (s-(s-a)*(s-b)*(s-c))

a= int(input(“Enter side 1 of triangle \t:\t” ))


b=int(input(“Enter side 2 of triangle \t:\t” ))
c=int(input(“Enter side 3 of triangle \t:\t” ))

s=(a+b+c)/2.
area=((s-(s-a)*(s-b)*(s-c))**0.5)
print(“Area of Triangle = ”, area)

Prg 4. Write a Python program to input cost amount and selling amount and display profit or loss.

cost_price = float(input("Enter the Cost Price of an object :” ))


selling_price = float(input("Enter the Selling Price of an object :"))
if(cost_price>selling_price):
amount = cost_price-selling_price
print("Total Loss Amount = ", amount)
else:
amount=selling_price-cost_price
print("Total Profit Amount=", amount)

Prg 5. Write a program that accepts three colours from the user. If the user enters orange, red and green, respectively, the message "Indian Flag" is displayed,
otherwise, the message "Not an Indian Flag" is displayed.
color1 = input("Enter the first color: ").strip().lower()
color2 = input("Enter the second color: ").strip().lower()
color3 = input("Enter the third color: ").strip().lower()
if color1 == “orange” and color2 == "white" and color3 == "green":
print("This is Indian Flag")
else:
print("This is not Indian Flag")

Prg 6. Write a program to enter the age and height of a person and display the message if he is eligible to write the roller coaster or not. [Crietaria: The age must
be above 18 and the height must be above 1.5 meters]

age=int(input("Enter your age: "))


height=float(input("Enter your height in meters: "))
if age >= 18:
if height >= 1.5:
print("Eligible to ride the roller coaster.")
else:
print("Height at least 1.5 meters tall")
else:
print("Not Eligible")

Prg 7. Write a program to find the sum, product and average of 10 numbers entered by the user.

Sum=0
Product= 1
print(“Enter the numbers…”)
for i in range(1,11):
n = int(input(“ Number ” + str(i) + “\t”))
Sum = Sum + n
Product = Product * n
print(“Sum of numbers entered = ”, Sum)
print(“Product of numbers entered = ”, Product)
Avrg = Sum / 10
print(“Average of numbers = ”, Avrg)

Prg 8. Write a program to check whether the number input by the user is an Armstrong number or not.
[Armstrong Number: Sum of cubes of each digit = Number]
num = int(input("Enter a number: "))
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum = sum + digit ** 3
temp = temp - temp // 10

if num == sum:
print(num, "is an Armstrong number")
else:
print(num, "is not an Armstrong number")

Prg 9. Write a program to accept a number and print sum of following series:
1/1! + 2/2! + 3/3! + n/n!
n = int(input("Enter a number : "))
seriesSum = 0
factorial = 1
for i in range(1, n + 1):
factorial = factorial * i
term = i / factorial
seriesSum = seriesSum + term
print(“The sum of Series is : ”, seriesSum)

Prg 10. Write a program to store rollnumber wise names of your classmates in a list. Display the student name as per the roll number entered.

ClassStudents = [ ]
N = int(input(“Enter strength of class. ”))
for i in range(N) :
Sname=input(“Enter student name for Roll Number : \t ”+str(i+1))
ClassStudents.append(Sname)
print(“Enter Roll Number to See Student Name : ”)
rno = int(input())
if rno > N or rno<=0 :
print(“Sorry, this roll number is not there!”)
else :
print(Class students[rno - 1])

You might also like