list of 20 Python practical questions
Write a program to input a number and find its absolute value.
Write a program to input three numbers and print the largest number.
Write a program to input three numbers and print the smallest number.
Write a program to input a number and check if it is divisible by 3 or 5.
Write a program to sort three numbers in ascending order.
Write a program to find the factorial of a positive number.
Write a program to generate the following pattern using nested loops:
*
**
***
****
*****
Write a program to generate the following pattern using nested loops
A
AB
ABC
ABCD
ABCDE
Write a program to generate the following pattern using nested loops:
12345
1234
123
12
1
Write a program to input the value of x
and n
and print the sum of the series:Copy code
1 + x + x^2 + x^3 + ... + x^n
Write a program to input the value of x
and n
and print the sum of the alternating series:
1 - x + x^2 - x^3 + ... + (-1)^n * x^n
Write a program to input the value of x
and n
and print the sum of the series:
x + x^2/2 + x^3/3 + x^4/4 + ... + x^n/n
Write a program to input the value of x
and n
and print the sum of the series:bashCopy code
x + x^2/2! + x^3/3! + x^4/4! + ... + x^n/n!
Write a program to check if a number is a perfect number.
Write a program to check if a number is an Armstrong number.
Write a program to check if a number is a palindrome.
Write a program to input a number and check if it is a prime or composite number.
Write a program to display the first n
terms of the Fibonacci series.
Write a program to compute the greatest common divisor (GCD) of two integers.
Write a program to compute the least common multiple (LCM) of two integers.