AI File
AI File
INTELLIGENCE
(PRACTICAL FILE)
SUBJECT CODE: 417
(Language: Python)
____________________________________
Salwan Public School
Sector-15(II), Gurgaon-122001
TABLE OF CONTENT
S.NO PROGRAM T. Sign
.
1. Write a program to check whether a number taken from the user is even or odd
number.
Example: Input: 5
Output: 5 is Odd number
2. Write a program to find the largest number among the three input number.
3. Write a program to check whether the number entered is a prime number or not.
4. Write a program to print the table of any given number by the user in the given
format.
Example: 2 * 1 = 2
2*2=4
and so on….
5. Write a program to find the sum of the natural number up to n, where the ‘n’ is
the number entered by the user.
Example: if n=10
1+2+3+4+5+6+7+8+9+10 = 44
7. Write a program to ask the user to provide the integer inputs to make a list. Store
only the even values given and print the list.
Example: If input list is [1,2,3,4,5,6,7,8,9,10]
List stored and print is [2,4,6,8,10]
9. Write a program to ask the user to provide the integer inputs to make a list. Print
the list created and also the reverse order of the list.
10. Write a program to display the square of the first five natural numbers.
Example: Input 1, 2, 3, 4, 5
Output: 1, 4, 9. 16, 25
11. Write a program to find the factorial of a given number by the user.
Example:
Input: 5
Output: 5 * 4* 3* 2* 1 = 120
12. Display the Fibonacci sequence up to nth term, where the user provides the value
of n.
Example: n=10
Output: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
Answer 1
Program to check whether a number is even or odd.
Output:
Answer 2
Program to find the largest number among the 3 input
numbers.
Output:
Answer 3
Program to check the number is prime or not.
Output:
Answer 4
Program to print the table of a given number.
Output:
Answer 5
Program to find the sum of the ‘n’ natural numbers.
Output:
Answer 6
Program to find the length of a string.
Output:
Answer 7
Program to make a list of even numbers from a given list.
Output:
Answer 8
Program to check the eligibility of a person to vote
(minimum 18 years).
Output:
Answer 9
Program to make the list in reverse order.
Answer 10
Program to display the square of first 5 natural numbers.
Output:
Answer 11
Program to find the factorial of a number.
Output:
Answer 12
Program to display the Fibonacci sequence upto nth term.
-
Output:
---––