Python Sheets of Functions
Python Sheets of Functions
1. Write a function in all the three types and Find the Factorial of the integer.
2. Write a function in all the three types and Find the Simple Interest.
3. Write a function in all the three types and Find the Reverse of the integer. (Ex: Input: 2435 Output: 5342)
4. Write a function in first two types to input an integer. Print the Factors of the integer. (Ex: Input: 6 Output: 1,2,3,6)
5. Write a function in first two types to input an integer. Print the Multiplication table till 20 of the integer.
6. Write a function in all the three types and Find the Sum of the digits of the integer. (Ex: Input: 2354 Output: 14)
7. Write a function in all the three types and Find the Product of the first and last digit of the integer. (Ex: Input: 2354
Output: 8)
8. Write a function in all the three types and check whether it is a Prime number or not.
9. Write a function in all the three types and check whether it is a Palindrome number or not.
10. Write a function in all the three types and check whether it is a Perfect number or not. (Ex. 6 = 2x6 = 1+2+3+6)
11. Write a function in all the three types and check whether it is an Armstrong number or not. (Ex. 153 = 13+53+33)
12. Write a function in all the three types and check whether it is a Special number or not. (Ex. 145 =1! + 4! + 5!)
13. Write a function in all the three types and check whether it is an Automorphic number or not. (Ex. 5= 25, 25 = 625)
14. Write a function in all the three types and check whether it is a Buzz number or not. (Number which either ends
with 7 or divisible by 7)
15. Write a function in all the three types to input two integers and print their LCM.
16. Write a function in all the three types to input two integers and print their HCF.
17. Write a function in all the three types to input a number and print sum of all the digits and count of all the digits.
Input: 5623 Output: Count = 4, Sum = 16
18. Write a function in all the three types and check whether it is a Neon number or not. (Ex. 9 = 9x9 = 81, 8+1=9)
19. Write a function in all the three types to input two integers n and p. Find and print n raised to the power p without
using function
20. Write a function in all the three types to input an integer n1 and another integer n2. Merge n2 after n1 and store
merged number M. Print n1, n2 and merged number M. (Ex. Input: n1=24, n2=567 Output: M=24567)
21. Write a function in all the three types to input an integer and find out the difference between the greatest and the
lowest digit present in the number.
22. Write a function in first two types to print all twin prime numbers from 2 to 500. (Twin Prime is prime numbers
whose difference is 2. Ex: 3,5 : 5,7 : 11,13 : 17,19 : etc.)
23. Write a function in first two types to print all Perfect numbers from 0 to 1000.
24. Write a function in first two types to print all Armstrong numbers from 0 to 1000.
25. Write a function in first two types to print all Special numbers from 0 to 1000.
26. Write a function in first two types to print all Automorphic numbers from 0 to 1000.
27. Write a function in first two types to print the following series on the screen. Each number should be printed
followed by one blank space.
a. 1, 3, 6, 11, 20 . . . . . . . . . . . . . . . . . . . . .10 terms
b. 1, 11, 111, 1111, . . . . . . . . . . . . . . . . . .10 terms
c. 1, 1, 2, 3, 5, 8 . . . . . . . . . . . . . . . . . . . . .10 terms
d. 1, 3, 6, 10, 15, . . . . . . . . . . . . . . . . . . . . .10 terms
e. 1, 4, 9, 16, 25, . . . . . . . . . . . . . . . . . . . . .10 terms
f. 1, 8, 27, 64, . . . . . . . . . . . . . . . . . . . . . ..10 terms
28. Write a function in all the three type to find the sum of the following series
a. 1 – 2 + 3 – 4 + 5 – . . . . . . . . . . . . . . . . .. . . . . . . . . .10 terms
b. 0 + 1 + 1 + 2 + 3 + 5 + 8 + . . . . . . . . . . . . . . . . . . . . .10 terms
c. 2 + 3 + 5 + 8 + 12 + 17 + . . . . . . . . . . . . . . . . . . . . . .10 terms
d. 12 + 33 + 55 + . . . . . . . . . . . . . . . . . . . . . . . . .. . . . .. .10 terms
e. (1x22) + (2x32) + (3x42) + . . . . . . . . . . . . . . . . . . . . .10 terms
Prepared By: Kumar Gaurav Sir Page 1
f. ½ + ¾ + 5/6 + . . . . . . . . . . . . . . . . . . . .. . . . . . . . .. . .10 terms
g. 1/1! + 2/3! + 3/5! + . .. . . . . . . . . . . . . . . . . .. . . .10 terms
h. 1+(1+2)+(1+2+3)+(1+2+3+4)+ . . . . . . . . . . . . . .10 terms
29. Write a function in first two types to print the following patterns :
A 12345 b 1 c 54321 d 12345 e 1 f 11111 g 0
12341 12 5432 1234 11 1111 101
12312 123 543 123 111 111 21012
12123 1234 54 12 1111 11 3210123
11234 12345 5 1 11111 1 432101234
H A i ABCDE j 54321 k 1 l 55555 m 12345 n 123 4
ab FGHI 4321 22 4444 1234 246 8
abc JKL 321 333 333 123 3 6 9 10
abcd MN 21 4444 22 12 4 8 1216
abcde O 1 55555 1 1
O 1a p 1 q 12345 r 1 s 1 t 1 2 3 4 5 U 5
2b 3c BB ABCD b c 10 F G H I 10-15
4d 5e 6f 333 123 4 5 6 101 10 11 12 20-25-30
7g 8h 9i 10j CCCC AB g h I j 1010 M N 35-40
55555 1 11 12 13 14 15 10101 15 45
V ZYXW w 10 9 8 7 x 1 y 1 z 4
VUT 654 35 2-3 434
SR 32 7 9 11 4-5-6 43234
Q 1 7-8-9-10 4321234
43234
434
4
30.