Practical File
Practical File
5. Write a program to input the value of x and n and print the sum of the following series:
a) 1+x+x2+x3+x4+…………xn
b) 1-x+x2-x3+x4…………xn
𝑥2 𝑥3 𝑥4 𝑥𝑛
c) 𝑥 − + − …………………
2 3 4 𝑛
𝑥2 𝑥3 𝑥4 𝑥𝑛
d) 𝑥 + − + …………………
2! 3! 4! 𝑛!
6. Determine whether a number is a perfect number, an armstrong number or a palindrome.
7. Input a number and check if the number is a prime or composite number.
8. Display the terms of a Fibonacci series.
9. Compute the greatest common divisor and least common multiple of two integers.
10. Count and display the number of vowels, consonants, uppercase, lowercase characters in string.
11. Input a string and determine whether it is a palindrome or not; convert the case of characters in
a string.
12. Find the largest/smallest number in a list/tuple.
13. Input a list of numbers and swap elements at the even location with the elements at the odd
location.
14. Input a list/tuple of elements, search for a given element in the list/tuple.
15. Input a list of numbers and find the smallest and largest number from the list.
16. Create a dictionary with the roll number, name and marks of n students in a class and display
the names of students who have scored marks above 75.