Do the following questions and submit the hardcopies on the day of
AI Practical Exam.
Write a program to:
1. Display all the numbers between 2 and 100 that are divisible by 11
but not by 2.
2. Print the Fibonacci series. (0, 1, 1, 2, 3, 5, 8, 13, ….)
3. Check whether the given number is a Prime number or not.
4. Print the factorial of a given number. (Factorial means product of
positive integers from 1 to the given number.
Eg. 5!= 5 X 4 X 3 X 2 X 1=120)
5. Print the following pattern- 5 4 3 2 1
5432
543
54
5
6. Accept a number from the user and check if it is Palindrome or
not. (without converting it to a string)
7. Assume a list List_1=[10,20,30,40]. Do the following operations
and print after each step.
a) Add the list [14,15,12] using extend function.
b) Input an element and add to the list using the append function.
c) Input a list using eval and add to the list using append function.
d) Sort the final list in ascending order and print it.
e) Input a element and insert it to the 3rd position.
f) Delete the last element
g) Delete 20 from the list
h) Delete 3rd-5th position elements from the list in a single
statement.
8. Input 5 numbers using a loop and store them as a Tuple.
1. Display all the numbers between 2 and 100 that are
divisible by 11 but not by 2.
CODE:
OUTPUT:
2. Print the Fibonacci series. (0, 1, 1, 2, 3, 5, 8, 13, ….)
CODE:
OUTPUT:
3. Check whether the given number is a Prime
number or not.
CODE:
OUTPUT:
4. Print the factorial of a given number.
(Factorial means product of positive integers
from 1 to the given number.
Eg. 5!= 5 X 4 X 3 X 2 X 1=120)
CODE:
OUTPUT:
5. Print the following pattern- 5 4 3 2 1
5432
543
54
5
CODE:
OUTPUT:
6. Accept a number from the user and check if it is
Palindrome or not. (without converting it to a string)
CODE:
OUTPUT:
7. Assume a list List_1=[10,20,30,40]. Do the following operations and print
after each step.
a) Add the list [14,15,12] using extend function.
b) Input an element and add to the list using the append function.
c) Input a list using eval and add to the list using append function.
d) Sort the final list in ascending order and print it.
e) Input a element and insert it to the 3rd position.
f) Delete the last element
g) Delete 20 from the list
h) Delete 3rd-5th position elements from the list in a single statement.
CODE:
7. Assume a list List_1=[10,20,30,40]. Do the following operations and print
after each step.
a) Add the list [14,15,12] using extend function.
b) Input an element and add to the list using the append function.
c) Input a list using eval and add to the list using append function.
d) Sort the final list in ascending order and print it.
e) Input a element and insert it to the 3rd position.
f) Delete the last element
g) Delete 20 from the list
h) Delete 3rd-5th position elements from the list in a single statement.
OUTPUT:
8. Input 5 numbers using a loop and store them as
a Tuple.
CODE:
OUTPUT: