Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Python Institute Exam PCAP-31-03 Topic 4 Question 63 Discussion

Actual exam question for Python Institute's PCAP-31-03 exam
Question #: 63
Topic #: 4
[All PCAP-31-03 Questions]

What is the expected behavior of the following code?

x = 8 ** (1/3)

y = 2. if x < 2.3 else 3.

print(y)

Show Suggested Answer Hide Answer
Suggested Answer: A, D

Contribute your Thoughts:

Penney
2 days ago
I'm not sure, but I think the code is erroneous and will not execute
upvoted 0 times
...
Heike
3 days ago
I disagree, I believe the answer is D) it outputs 3.0
upvoted 0 times
...
Meghan
4 days ago
Wait, wait, wait... I think the answer is B) it outputs 2.5. Hear me out, okay? The expression 8 ** (1/3) evaluates to 2.0, and then the 'if x < 2.3 else 3.' part should give us 2.0 as the final result. Easy peasy!
upvoted 0 times
...
Cheryl
5 days ago
I think the answer is A) it outputs 2.0
upvoted 0 times
...
Murray
5 days ago
Hmm, let's see... I'm pretty sure the output is going to be 3.0. I mean, come on, the question says 'if x < 2.3 else 3.', and we all know that 8 ** (1/3) is greater than 2.3, so the else part should kick in. This is a no-brainer!
upvoted 0 times
...
Lovetta
9 days ago
I'm not sure, but I think the code is erroneous and will not execute
upvoted 0 times
...
Pa
11 days ago
I disagree, I believe the answer is D) it outputs 3.0
upvoted 0 times
...
Sylvie
14 days ago
I think the answer is A) it outputs 2.0
upvoted 0 times
...

Save Cancel