Python Prog
Python Prog
Note : The radian is the standard unit of angular measure, used in many areas of
mathematics. An angle's measurement in radians is numerically equal to the length
of a corresponding arc of a unit circle; one radian is just under 57.3 degrees
(when the arc length is equal to the radius).
Test Data:
Degree : 15
Expected Result in radians: 0.2619047619047619
Click me to see the sample solution
2. Write a Python program to convert radians to degrees.
Test Data:
Radian : .52
Expected Result : 29.781818181818185
3. Write a Python program to calculate the area of a trapezoid.
Note : A trapezoid is a quadrilateral with two sides parallel. The trapezoid is
equivalent to the British definition of the trapezium. An isosceles trapezoid is a
trapezoid in which the base angles are equal so.
Test Data:
Height : 5
Base, first value : 5
Base, second value : 6
Expected Output: Area is : 27.5
Click me to see the sample solution
4. Write a Python program to calculate the area of a parallelogram.
Note : A parallelogram is a quadrilateral with opposite sides parallel (and
therefore opposite angles equal). A quadrilateral with equal sides is called a
rhombus, and a parallelogram whose angles are all right angles is called a
rectangle.
Test Data:
Length of base : 5
Height of parallelogram : 6
Expected Output: Area is : 30.0
Click me to see the sample solution
5. Write a Python program to calculate the surface volume and area of a cylinder.
Note: A cylinder is one of the most basic curvilinear geometric shapes, the surface
formed by the points at a fixed distance from a given straight line, the axis of
the cylinder.
Test Data:
volume : Height (4), Radius(6)
Expected Output:
Volume is : 452.57142857142856
Surface Area is : 377.1428571428571
volume = pi * radian * radian * height
sur_area = ((2*pi*radian) * height) + ((pi*radian**2)*2)
6. Write a Python program to calculate the surface volume and area of a sphere.
Note: A sphere is a perfectly round geometrical object in three-dimensional space
that is the surface of a completely round ball.
Test Data:
Radius of sphere : .75
Expected Output :
Surface Area is : 7.071428571428571
Volume is : 1.7678571428571428
Click me to see the sample solution
7. Write a Python program to calculate the arc length of an angle.
Note: In a planar geometry, an angle is the figure formed by two rays, called the
sides of the angle, sharing a common endpoint, called the vertex of the angle.
Angles formed by two rays lie in a plane, but this plane does not have to be a
Euclidean plane.
Test Data:
Diameter of a circle : 8
Angle measure : 45
Expected Output :
Arc Length is : 3.142857142857143
Click me to see the sample solution
10. Write a Python program to find the smallest multiple of the first n numbers.
Also, display the factors.
Test Data:
If n = (13)
Expected Output :
[13, 12, 11, 10, 9, 8, 7]
360360
Click me to see the sample solution
11. Write a Python program to calculate the difference between the squared sum of
the first n natural numbers and the sum of squared first n natural numbers.(default
value of number=2).
Test Data:
If sum_difference(12)
Expected Output :
5434
Click me to see the sample solution
12. Write a Python program to calculate the sum of all digits of the base to the
specified power.
Test Data:
If power_base_sum(2, 100)
Expected Output :
115
Click me to see the sample solution
13. Write a Python program to find out if the given number is abundant.
Note: In number theory, an abundant number or excessive number is a number for
which the sum of its proper divisors is greater than the number itself. The integer
12 is the first abundant number. Its proper divisors are 1, 2, 3, 4 and 6 for a
total of 16.
Test Data:
If is_abundant(12)
If is_abundant(13)
Expected Output:
True
False
Click me to see the sample solution
14. Write a Python program to find out if the given number is abundant.
Note: Amicable numbers are two different numbers so related that the sum of the
proper divisors of each is equal to the other number. (A proper divisor of a number
is a positive factor of that number other than the number itself. For example, the
proper divisors of 6 are 1, 2, and 3.)
Test Data:
If amicable_numbers_sum(9999)
If amicable_numbers_sum(999)
If amicable_numbers_sum(99)
Expected Output:
31626
504
0
Click me to see the sample solution
15. Write a Python program to return the sum of all divisors of a number.
Test Data:
If number = 8
If number = 12
Expected Output:
7
16
Click me to see the sample solution
16. Write a Python program to print all permutations of a given string (including
duplicates).
Click me to see the sample solution