0% found this document useful (0 votes)
11 views1 page

CFD Igc A2

The document contains a list of programming tasks in Python, including printing even numbers, checking for prime numbers, generating Fibonacci series, and calculating factorials. It also covers concepts like the use of break and continue statements, user input handling, and implementing games like Rock-Paper-Scissors. Additionally, it includes mathematical series and interest calculations, providing a comprehensive set of exercises for practicing Python programming.

Uploaded by

yourhimanshu10
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)
11 views1 page

CFD Igc A2

The document contains a list of programming tasks in Python, including printing even numbers, checking for prime numbers, generating Fibonacci series, and calculating factorials. It also covers concepts like the use of break and continue statements, user input handling, and implementing games like Rock-Paper-Scissors. Additionally, it includes mathematical series and interest calculations, providing a comprehensive set of exercises for practicing Python programming.

Uploaded by

yourhimanshu10
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/ 1

1. Write a program to print even numbers using the continue statement.

2. Write a Python program to accept a number from the user and check if it is prime or not.

3. Write a Python program to print the first 10 numbers of the Fibonacci series.

4. Write a program to print the following series up to n terms: 4, 44, 444, . . ..

5. Write a program to print the multiplication table of 7 using the break statement.

6. Write a program to determine how many numbers between 1 and 10,000 contain the digit 3.

7. Given a string s, s.index(’x’) returns the index of the first x in s and an error if there is no x.

(a) Write a program that asks the user for a string and a letter. Using a while loop, the program should print
the index of the first occurrence of that letter and a message if the string does not contain the letter.
(b) Write the above program using a for/break loop instead of a while loop.

8. Write a program to calculate the sum of the first 10 numbers using a for loop.

9. Write a program that computes the factorial of a number. The factorial, n!, of a number n is the product of all the
integers between 1 and n, including n.

10. Adding certain numbers to their reversals sometimes produces a palindromic number. For instance, 241+142 = 383.
Sometimes, we have to repeat the process. For instance, 84 + 48 = 132 and 132 + 231 = 363. Write a program that
finds both two-digit numbers for which this process must be repeated more than 20 times to obtain a palindromic
number.

11. What is the difference between the break and continue statements? Provide the solution with coding examples.

12. Write a program to calculate the interest rate of 3%, with compound interest increasing by 0.4 each month up to
12 months, for a loan of 1,00,000.

13. Write a program that lets the user play Rock-Paper-Scissors against the computer. In that program, there were
exactly five rounds. Rewrite the program so that it is a best 3 out of 5. That is, the first player to win three times
is the winner.

14. Write a program to find the sum of the series 0.1 + 2 + 6 + 24 + 120 + . . . up to n terms.

15. What is a nested loop? Explain by using an example.

You might also like