0% found this document useful (0 votes)
19 views

Python

The document contains a list of 21 programming problems or exercises related to loops, functions, and other programming concepts. The problems include writing programs to: print Armstrong numbers using loops; reverse and calculate digits of numbers using loops; exchange variable values; compute sums and averages of numbers using loops; display squares of numbers using loops; calculate series sums using loops; simulate spacecraft orbits and timing programs. It also includes problems involving random values, exiting programs, drawing shapes, midpoint calculations, local variable protection, GCD calculations, calculators, validating user input, and simulating dice rolls.

Uploaded by

Praveen TP
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Python

The document contains a list of 21 programming problems or exercises related to loops, functions, and other programming concepts. The problems include writing programs to: print Armstrong numbers using loops; reverse and calculate digits of numbers using loops; exchange variable values; compute sums and averages of numbers using loops; display squares of numbers using loops; calculate series sums using loops; simulate spacecraft orbits and timing programs. It also includes problems involving random values, exiting programs, drawing shapes, midpoint calculations, local variable protection, GCD calculations, calculators, validating user input, and simulating dice rolls.

Uploaded by

Praveen TP
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TEST-2

1. Program to print all 3 digit Armstrong numbers using while and for

loop.

2. Program to prit the reverse of a given number using while loop.

3. Program to print the sum of digits of a given number using while loop.

4. Program to exchange the values of two variables.

5. Program for computing the sum of n natural numbers and finding out

the average of it using while loop.

6. Program for displaying square of n numbers using while loop.

7. Program to the sum of 1+1/2+1/3+1/4+.............+1/N series using while

loop.

8. Program that prints the distances from the spacecraft to the satellite in

60-degree orbit increments.

9. Program that measusers how long it takes a user to enter a character

from the keyboard.

10. Program that measuers the time it takes to add up all the integers from

1 to 100000000.

11. program that measures how long it takes to count all the prime

numbers up to 10000.

12. program counts down from 10 with one second intervals between

numbers.

13. Program that select a random element from a tuple of strings .

14. Program that uses a sys.exit () function to end the programs execution
TEST-2

after it prints 10 numbers.

15. Program that uses a turtle graphics to draw regular polygons with the

given number of sides.

16. Program that uses a custom function to compute the midpoint between

two mathematical points.

17. Program that illustrates how function definitions provide protection

for local variables.

18. Program that computes the GCD of two integers provided by the user

using main( ) function.

19. Program for creating a simple calculator using functions.

20. Program that uses a function named get_int_in_range( ) that does not

return until the user suplies a proper value.

21. Program that simulates rolling of a die using functions.

You might also like