Programming Using Python Practicals
Programming Using Python Practicals
1) Write a Python program to check whether the given number is even number or odd
number.
2) Write a Python to find the biggest number from the given 2 numbers using built-in
function and if statement.
3) Write a Python to find the biggest number from the given 3 numbers using built-in
function and nested if statement.
4) Write a Python program to print the first N natural number.
5) Write a Python program to print all the natural numbers till N.
6) Write a Python program to print the first N natural odd number using while and for
loop.
7) Write a Python program to print the first N natural even number using while and for
loop.
8) Write a Python program to check whether the given year is leap year or not.
9) WAP to add N natural numbers and display their sum
10) Write a Python program to display the factorial of the given N number.
11) Write a Python program to swap 2 numbers in a single statement.
12) Write a Python program to find the roots of the quadratic equation.
13) Write a Python to calculate the total marks, percentage and grade of a student. Marks
obtained in each of the three subjects are to be input by the user. Assign grades
according to the following criteria:
Grade A: if Percentage >= 80
Grade B: if Percentage >= 60 and Percentage < 80
Grade C: if Percentage >= 40 and Percentage < 60
Grade D: if Percentage < 40
14) Write a Python that takes a positive integer n and then produce n lines of output:
*
* * *
* * * * *
* * * * * * * (sample output for n=4)
15) Write a Python that takes a positive integer n and then produce n lines of output:
* * * *
* * *
* *
* (sample output for n=4)
16) Write a Python that takes a positive integer n and then produce n lines of output:
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1 (sample output for n=4)
17) WAP to print Fibonacci series till the given number N. (eg. 1,1,2,3,5,8,13 for n=7)
18) Write a Python program to print the first N prime number.
19) Write a Python program to print all the prime numbers till N.
20) WAP to print the following conversion table (use Loop constructs):
Height (in Feet) Height (in Inches)
5.0 ft 60 inches
5.1 ft 61.2 inches
…. ….
6.0 ft 72 inches