Explanation:
- number = 7: Assigns the value 7 to the variable number.
- if(number == 7): Checks if number is equal to 7.
- This condition is True, so it enters the if block.
- number += 1: Increases number by 1. Now, number is 8.
- print("1"): Prints 1 because the first condition was True.
- if number == 8: Checks if the updated number is 8.
- This condition is also True, so it prints 2.
- The else block is ignored because the first if condition was True.
Output:
0 Comments:
Post a Comment