PCEP 30 02 PCEP Certified Entry Level Python Programmer · Free Practice Question Medium

Question 5

What will be the output of the following code ?

num = 3//2 *3

if num > 3:

    print("Hello World")

else:

    print("Something Different")

  • A

    It will print Something Different

  • B

    Nothing will be printed

  • C

    It will print Hello World

  • D

    It will raise an error

Reveal correct answer

Correct answer: A

Explanation

num will evaluate to 3. Since , if condition is not True, else block will be executed.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need