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

Grade 11 Python Assignment: Iterative Statements

The document outlines an assignment for Grade 11 students at National Public School, Koramangala, focusing on Python programming tasks. Students are required to write scripts for various problems including checking twin-prime numbers, generating patterns, reducing numbers to single digits, calculating series sums, generating Juggler sequences, and classifying numbers as perfect, abundant, or deficient. The assignment spans from July 10, 2024, to June 27, 2024.

Uploaded by

ankita.sahu.nps
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)
6 views2 pages

Grade 11 Python Assignment: Iterative Statements

The document outlines an assignment for Grade 11 students at National Public School, Koramangala, focusing on Python programming tasks. Students are required to write scripts for various problems including checking twin-prime numbers, generating patterns, reducing numbers to single digits, calculating series sums, generating Juggler sequences, and classifying numbers as perfect, abundant, or deficient. The assignment spans from July 10, 2024, to June 27, 2024.

Uploaded by

ankita.sahu.nps
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

National Public School, Koramangala

Term 1 2024-25
Assignment 3-Iterative Statements
Grade 11
Start Date:10.07.24 Completion Date: 27.06.24
Write Python scripts for the following.
1. Input 2 numbers from the user and check if they are twin-prime numbers. Twin prime numbers are 2
prime numbers where the difference between them is 2.
E.g. :- 5 and 7, 11 and 13, 17 and 19 are twin-primes while 2 and 3 or 7 and 9 or 13 and 17 are not twin-
primes.
2. Generate a pattern as shown below: Input number of rows in the first half of the triangle n from the
User. E.g.1: If n=5 then the pattern is:

3. Input a number num from the user. Form a new number by adding the digits of num. Repeat the same
procedure until the new number so obtained is a single digit number. Display num and the single digit
number obtained in the last iteration.
E.g.: Input a number: 1478
1st iteration:
num =1478
newnum = 1+4+7+8=20
2nd iteration:
num=20
newnum=2+0 = 2
Output format:
Number Entered : 1478
Single digit number obtained: 2
4. Input values for x and n from the user and print the sum of the following series:
2 4 6 8
x x x x
1− + − + −… upto n terms
2 ! 4 ! 6 ! 8!
E.g.1:- If x= 2, n =3, Sum = -0.33
E.g.2:- If x =3 and n=4, Sum= -0.65
5. A Juggler Sequence is a series of integer numbers in which the first term starts with a positive integer
number and the remaining terms are generated from the immediate previous term using the below
formula until 1 is reached:

E.g.1: Juggler Sequence starting with number 3:


3, 5, 11, 36, 6, 2, 1
E.g.2: Juggler Sequence starting with number 9:
9, 27, 140, 11, 36, 6, 2, 1

Input a positive integer <10 from the user and print the Juggler Sequence.

6. Write a menu-based program for the following.


Input a positive number n from the user and check if it is a perfect or an abundant or a deficient number.
A number is considered perfect if the sum of its proper divisors (excluding itself) equals the number itself.
For example, 6 is perfect because its proper divisors (1, 2, and 3) add up to 6:

1+2+3=6

The first few perfect numbers are 6, 28, 496, and 8128.

An abundant number has a sum of proper divisors greater than the number itself.
For instance, consider 12. Its proper divisors are 1, 2, 3, 4, and 6, and their sum is 16:

1+2+3+4+6=16

Since 16 > 12, 12 is an abundant number


The first five abundant numbers are 12, 18, 20, 24, and 30

A deficient number has a sum of proper divisors less than the number itself.
For example, 8 is deficient because its proper divisors sum to 7:

1+2+4=7

Other examples of deficient numbers include 1, 2, 3, 4, 5, 7, 8, and 9.

Sample menu format: 1. Input number


1. Input number 2. Display no. type
2. Display no. type 3. Quit
3. Quit Enter your choice: 2
Enter your choice: 1 12 is an abundant number.
Enter Number: 12 1. Input number
2. Display no. type
3. Quit
Enter your choice: 3

You might also like