CONDITIONAL STATEMENT

1 of
Published on Video
Go to video
Download PDF version
Download PDF version
Embed video
Share video
Ask about this video

Page 1 (0s)

i f (Conditional Execution) i f-else (Alternative Execution) i f- elif -else (Chained Conditional Execution) Nested conditionals.

Page 2 (8s)

If Conditional Execution. 1/4/2021. S.SATHISH, AP/CSE - SRIET.

Page 3 (24s)

Example Program:. 1.Checking pass or fail:. a=int(input(Enter the number).

Page 4 (56s)

If the condition is true, then body of if statement will be executed..

Page 5 (1m 16s)

Example: 1. Odd or Even. Program:. number = int(input(Enter the Number).

Page 6 (1m 49s)

Example: 2. Greatest of two numbers. Program:. a= int(input(Enter the Number).

Page 7 (2m 20s)

1/4/2021. S.SATHISH, AP/CSE - SRIET. 7. Example: 3. Leap Year of Not 4. Positive or Negative Number 5. Eligibility for voting.

Page 8 (2m 30s)

This is used to check more than one condition.. If the condition1 is False, it checks the condition2 of the elif block. If all the conditions are False, then the else part is executed..

Page 9 (2m 51s)

1/4/2021. S.SATHISH, AP/CSE - SRIET. 9. condition_l Eal se rue False condition_2 Block statement_ 1 rue condition_n Block statement_2 rue Block statement_n default statement.

Page 10 (2m 59s)

1. Traffic light Program:. Program:. colour =input(Enter the Colour of light).

Page 11 (3m 28s)

2. Student Mark System:. Program:. mark=int(input(Enter the Mark).

Page 12 (4m 1s)

Output:. Enter the Mark. 75. 1/4/2021. Grade = A.

Page 13 (4m 12s)

One conditional can also be nested within another..

Page 14 (4m 33s)

1. Greatest of Three Numbers:. Program:. a=int(input(Enter the value of a)).

Page 15 (5m 6s)

Output:. Enter the value of a. 15. 1/4/2021. S.SATHISH, AP/CSE - SRIET.