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

Python Practice Programs for Beginners

Python problems

Uploaded by

areebaanjum176
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Python Practice Programs for Beginners

Python problems

Uploaded by

areebaanjum176
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Practice Programs

1. If the marks obtained by a student in five different subjects are input through the keyboard,
find out the aggregate marks and percentage marks obtained by the student. Assume that
the maximum marks that can be obtained by a student in each subject is 100.

2. Write a program that inputs the initial velocity, acceleration and time values from the user.
The program should then compute final velocity using Newton’s first equation of motion and
distance travelled according to Newton’s second and third equations of motion, respectively.

3. Write a C-Program to swap two integer numbers without and with using third variable.

4. Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a program
to convert this temperature into Centigrade degrees.

5. Write a C-program to calculate area and perimeter of a triangle.


Area of triangle = 1/2 *base *vertical height
Perimeter of a triangle = a + b +c

6. There are 3600 seconds in a hour and 60 seconds in a minute. The software company
attendance system is being designed in a new way. The boss has required software to
calculate the office hours of the employees which can accept the employee office hours in
the form of seconds and outputs the equivalent time in the form of hours minutes and
seconds.

7. Write a program that takes a 3 digit number as an input and outputs the reverse of the
number. (Hint: It takes the digit as a single input and separates the digits using the modulus
and division operator.)

8. Find square/cube of a number


9. Find sum/difference/product/division of two/three numbers
10. Find average of two numbers
11. Find velocity from given distance and time
12. Find acceleration from given velocity and time
13. Calculate area of a rectangle ( area = base * height )
14. Calculate marks percentage ( marks percentage = marks obtained / total * 100 )
15. Calculate sales tax ( tax = amount * tax percentage / 100 )
16. Find ‘no. of minutes’ and ‘no. of seconds’ from given ‘no. of hours’

17. Find the value of F (centripetal force) for given values of mass ‘m’, velocity ‘v’ and
radius ‘r’ (where F = mv2 / r)
18. Find the value of A such that A = (4x – 3y) / 2z
19. Find the value of distance ‘D’ for given values of ‘x’, ‘v’,‘t’, ‘a’
(where D = x + vt + 1/2at2)
20. Find the value of A such that A = (a - b)2 / 2c
21. Find the value of E (total energy) for given values of ‘m’, ‘v’, ‘g’, ‘h’
(where E = mv2 / 2 + mgh)
22. Find the value of A such that A = (a + b)2 – 2ab
23.

Common questions

Powered by AI

By using the modulus operator (%), you can extract each digit from the number. For example, with number n: the last digit is n % 10, the second digit is (n/10) % 10, and the first digit is n/100. These extracted digits can then be recombined in reverse order .

Total energy is calculated by summing up kinetic and potential energy: E = (mv^2 / 2) + mgh, where m is mass, v is velocity, g is gravitational acceleration, and h is height .

First, calculate the number of hours by dividing the total seconds by 3600. Then, determine the remaining seconds and calculate the minutes by dividing those by 60. The leftover seconds are the final seconds value .

Swapping two integers without a third variable can be done via arithmetic operations: let a = a + b, b = a - b, and a = a - b. Using a third variable involves storing one of the numbers: temp = a, a = b, and b = temp .

For the area, use the formula: area = 1/2 * base * height. For the perimeter, sum the lengths of all sides: perimeter = a + b + c, where a, b, and c are the side lengths .

To calculate the aggregate marks, sum the marks obtained in all five subjects. The percentage marks can be calculated using the formula: (total marks obtained / 500) * 100, since the maximum marks per subject are 100, making the total maximum marks 500 .

Velocity can be determined by dividing the distance by the time: velocity = distance / time .

The program should implement the formula to convert Fahrenheit to Centigrade: C = (F - 32) * 5/9, where C stands for Centigrade and F stands for Fahrenheit .

Centripetal force is calculated using the formula F = mv^2 / r, where m is the mass, v is the velocity, and r is the radius. The force depends directly on the mass and the square of velocity, and inversely on the radius .

Final velocity can be calculated using the formula v = u + at. The distance traveled can be computed using s = ut + 1/2at^2, where u is the initial velocity, a is the acceleration, t is the time, v is the final velocity, and s is the distance .

You might also like