Python Code Snippets Made by Tanish Raina
Python Code Snippets Made by Tanish Raina
Output:
The sum is: 12
(B) Subtraction:
Output:
The subtraction is: 4
(C) Multiplication:
Output:
The multiplication is: 60
(D)Division:
Output:
The division is: 5.0
Output:
What is your age? 18
You are eligible to vote.
Output:
Enter a number: 10
Positive number
Q4] Check if a Number is Odd or Even
Output:
Enter a number: 7
The number is odd.
Output:
Enter year: 2025
The year isn’t a leap year!
Output:
Enter the first number: 5
Enter the second number: 9
The second number is greater.
Output:
Enter the first number:10
Enter the second number:15
Enter the third number:12
The largest number is 15
Output:
1 24
2 120
6
Q9] Python program to display multiplication table
Output:
Enter a number for table:5
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Output:
55
Q11] Python Program to Print the Fibonacci sequence
Output:
Enter a number:8
0
1
1
2
3
5
8
13
Q12] Python Program to Check Prime Number
Output:
Enter a number: 9
9 is not prime.
Q13] Python Program to Swap Two Variables
Output:
Enter value1: 5
Enter value2: 6
The value of a after swapping: 6
The value of b after swapping: 5
Output:
Enter a number: 370
370 is an Armstrong number