What will be the output of the following Python code? Question 1

29. What will be the output of the following Python code?

a=7
if a>4: print("Greater")
  1. Greater
  2. 7
  3. 4
  4. None of the mentioned above

Answer: A) Greater

Explanation:

When only one statement needs to be executed within an if block, the short hand if statement is used to accomplish this. This statement can be included in the same line as the if statement, if necessary. When using Python's Short Hand if statement, the following syntax is used:

if condition: statement

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.