Advertisements
Advertisements
Question
Write a note on if..else structure.
Advertisements
Solution
The if-else statement provides control to check the true block as well as the false block. Following is the syntax of the if-else statement.
Syntax:
if:
statements – block 1
else:
statements – block 2
APPEARS IN
RELATED QUESTIONS
How many important control structures are there in Python?
Which is the most comfortable loop?
What is the output of the following snippet?
i=1
while True:
if i%3 ==0:
break
print(i,end='')
i +=1
Which punctuation should be used in the blank?
if<condition>_
statement-block 1
else:
statement-block 2
Define control structure.
Write a note on the range () in the loop?
Write a program to display.
A
A B
A B C
A B C D
A B C D E
Write the syntax of the while loop.
List the differences between break and continue statements.
Write a detail note on for loop?
