Informatics Practices
What does the following code print to console?
if True:
print (101)
else:
print (202)
- 101
- 202
- 303
- 102
Python Control Flow
4 Likes
Answer
101
Reason — In Python, if True: will always evaluate to True, so the code block under the if branch will execute.
Answered By
1 Like
Related Questions
The symbol used to end the if statement:
- Semicolon (;)
- Hyphen ( - )
- Underscore ( _ )
- Colon (:)
Which of the following is a valid keyword?
- IF
- If
- if
- None of these
Which of the following is not a loop statement in Python?
- do-while
- while
- for
- All of these
What will be the output?
x = ['ab', 'cd'] for i in x: i.upper() print (x)- ['ab', 'cd']
- ['AB', 'CD']
- [None, None]
- None of these