Category: Python Programming Examples

python tutorials and learn python

Python Program for Finding the vertex, focus and directrix of a parabola

Python Program for Finding the vertex, focus and directrix of a parabola A set of points on a plain surface that forms a curve such that any point on that curve is equidistant from the focus is a parabola. Vertex of a parabola is the coordinate from which it takes the sharpest turn whereas a…

Python Program for Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane

Python Program for Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane Given three positive integers a, b and d. You are currently at origin (0, 0) on infinite 2D coordinate plane. You are allowed to jump on any point in the 2D plane…

Check if a triangle of positive area is possible with the given angles

Check if a triangle of positive area is possible with the given angles Given three angles. The task is to check if it is possible to have a triangle of positive area with these angles. If it is possible print “YES” else print “NO”. Examples: Input : ang1 = 50, ang2 = 60, ang3 =…

Python Program for Find the perimeter of a cylinder

Python Program for Find the perimeter of a cylinder Given diameter and height, find the perimeter of a cylinder. Perimeter is the length of the outline of a two – dimensional shape. A cylinder is a three – dimensional shape. So, technically we cannot find the perimeter of a cylinder but we can find the…

Python Program for Program to calculate area of a Tetrahedron

Python Program for Program to calculate area of a Tetrahedron A Tetrahedron is simply a pyramid with a triangular base. It is a solid object with four triangular faces, three on the sides or lateral faces, one on the bottom or the base and four vertices or corners. If the faces are all congruent equilateral…

Python Program for Number of stopping station problem

Python Program for Number of stopping station problem There are 12 intermediate stations between two places A and B. Find the number of ways in which a train can be made to stop at 4 of these intermediate stations so that no two stopping stations are consecutive? Examples – Input : n = 12, s…

Python Program for Print Number series without using any loop

Python Program for Print Number series without using any loop Problem – Givens Two number N and K, our task is to subtract a number K from N until number(N) is greater than zero, once the N becomes negative or zero then we start adding K until that number become the original number(N). Note :…

Python Program for Smallest K digit number divisible by X

Python Program for Smallest K digit number divisible by X Integers X and K are given. The task is to find smallest K-digit number divisible by X. Examples: Input : X = 83, K = 5 Output : 10043 10040 is the smallest 5 digit number that is multiple of 83. Input : X =…