Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
9 views7 pages

Program List 1

The document contains a list of programming exercises for Python, designed for a student named Aishwarya Thakur in class XI A. Each exercise includes a problem statement, input requirements, and example output, covering various topics such as basic arithmetic, geometry, conversions, and data handling. The exercises aim to enhance programming skills through practical applications.

Uploaded by

aishwaryath903
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)
9 views7 pages

Program List 1

The document contains a list of programming exercises for Python, designed for a student named Aishwarya Thakur in class XI A. Each exercise includes a problem statement, input requirements, and example output, covering various topics such as basic arithmetic, geometry, conversions, and data handling. The exercises aim to enhance programming skills through practical applications.

Uploaded by

aishwaryath903
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/ 7

Computer Science File

Program List 1

Aishwarya Thakur
XI A

Q1) Write a program to display all keywords in python.

Input:
import keyword
print(keyword.kwlist)

Output:

Q2) Write a program to input two numbers and find their sum and product.

Input:
a=float(input("Enter First Number: "))
b=float(input("Enter Second Number"))
print("Sum of",a,b, "is",(a+b))
print("Product of",a,b, "is",15(a*b))

Output:

Q3) Write a program to calculate simple interest by inputting the value of


Principal amount and Rate from the user for a Time period of 5 years.

Input:
p=float(input("Enter Principal Amount"))
r=float(input("Enter Rate"))
s=((p*r)*5)/100
print("Simple Interest is", s)

Output:
Q4) Write a program to calculate the area of a triangle by inputting the
value of base and height of triangle.

Input:
b=int(input("Enter base length of triangle"))
h=int(input("Enter height of triangle"))
a=b*h/2
print("Area of Triangle is ", a)

Output:

Q5) Write a program to accept the radius of a circle and print its area.

Input:
r=float(input("Enter radius of circle"))
a=(22/7)*r*r
print("Area of circle is: ", a)

Output:

Q6) Write a program to accept the marks of 5 subjects and display the
average.

Input:
a=int(input("Enter Marks in Subject 1: "))
b=int(input("Enter Marks in Subject 2: "))
c=int(input("Enter Marks in Subject 3: "))
d=int(input("Enter Marks in Subject 4: "))
e=int(input("Enter Marks in Subject 5: "))
avg=(a+b+c+d+e)/5
print("Average is ", avg)

Output:
Q7) Write a program to convert kilometres to miles.

Input:
km=float(input("Enter Distance in Kilometres"))
miles=km*0.621
print("This distance in miles is ", miles)

Output:

Q8) Write a program to convert Celsius to Fahrenheit.

Input:
c=float(input("Enter temperature in Celsius"))
f=c+(9/5)+32
print("Temperature in Fahrenheit is ", f)

Output:

Q9) Write a program to accept length and breadth and display the area and
perimeter of the rectangle.

Input:
l=float(input("Enter length of rectangle"))
b=float(input("Enter breadth of rectangle"))
print("Perimeter of Rectangle is, ", ((l+b)*2))
print("Area of the Rectangle is, ", (l*b))

Output:
Q10) Write a program to accept length and display the area and perimeter of
the square.

Input:
s=float(input("Enter side length of square "))
print("Perimeter of Square is, ", (4*s)
print("Area of the Square is, ", (s*s))

Output:

Q11) Write a program to input a number and write its first five multiples.

Input:
n=float(input("Enter a Number: "))
print(n, (n*2), (n*3), (n*4), (n*5))

Output:

Q12) Write a program to obtain a fee amount and then calculate a fee hike as
10% of fees.

Input:
f=float(input("Enter Fee Amount: "))
h=f+(10/100)*f
print("Price hike is: ",h)

Output:
Q13) Write a program to enter a small poem or poem verse and print it.
Input:
poem = input("Enter a small poem or verse:")
print("Your Poem")
print(poem)

Output:

Q14) Write a program to calculate in how many days a work will be completed
by three persons A, B and C together. A, B and c take x days, y days, and z
days respectively to do the job alone. The formula to calculate the number
of days, if they work together is xyz/xy+yz+xz days where x, y, and z are
given as inputs to the program.

Input:
x=int(input("Enter number of days taken by A to finish the job "))
y=int(input("Enter number of days taken by B to finish the job "))
z=int(input("Enter number of days taken by C to finish the job "))
print("Number of days to finish the job is A, B, and C work together: ",
((x*y*z)/((x*y)+(y*z)+(z*x))))

Output:

Q15) Write a program to input a value in tonnes and convert it into


quintals and kilograms.

Input:
t=float(input("Enter value in tonnes "))
print("Given value in quintals is ", (10*t))
print("Given value in kilograms is ", (100*t))

Output:
Q16) Write a program to write two numbers and swap them.
Input:
n1=int(input("Enter first number: "))
n2=int(input("Enter second number: "))
n1,n2=n2,n1
print(n1,n2)

Output:

Q17) Write a program to read details like name, class, and age of a student
and then print the details in the same line and then in separate lines.

Input:
name_student=str(input("Enter name of student "))
class_student=int(input("Enter class of student "))
age_student=int(input("Enter age of student "))
print(name_student, class_student, age_student)
print(name_student, class_student, age_student, sep='\n')

Output:

Q18) Write a program a number n and print n2, n3 and n4.

Input:
n=int(input("Enter n: "))
print(n**2, n**3, n**4)

Output:

You might also like