×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Data Types and Variables Swap Numbers - Python CBSE
Python Examples - If else Programs CBSE - Python Language
609    Arnab De    11/09/2020

If-else is the basic decision making block in python. We can use one or more conditions to take a decision, if this particular block is executed or not. Every condition under if the block returns true or false. If the result is true, then all the statements under if block will be executed. But if the result is false then all the statements under else block will be executed. Both if and else statement should ends with a colon(:). and all the statements under if statement should maintain proper indentation.

softetechnologies

Write a program to check a number is even or odd?

no=int(input("Enter A Number : "))
if(no%2==0):
	print(no," is an even no.")
else:
	print(no, " is an odd no.")
if else program python
softetechnologies

Write a program to check a number is magic or not?

no=int(input("Enter A Number : "))
if(no%9==1):
	print(no," is a magic no.")
else:
	print(no, " is not a magic no.")
Click Here to see the if-else programs in Java.
Data Types and Variables Swap Numbers - Python CBSE
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Sri Sri Ramakrishna Paramahamsa
All religions are true. God can be reached by different religions. Many rivers flow by many ways but they fall into the sea. They all are one.
Sri Sri Ramakrishna Paramahamsa
2220
32.45
Today So Far
Total View (Lakh)
softetechnologies
01/01/2018     33207
28/06/2017     29016
02/08/2017     26444
26/05/2018     25945
15/05/2017     22743
06/07/2017     21166
01/08/2017     20872
21/04/2018     18372
25/06/2018     17110
14/07/2017     15996
softetechnologies