exam questions

Exam PCAP-31-03 All Questions

View all questions & answers for the PCAP-31-03 exam

Exam PCAP-31-03 topic 1 question 48 discussion

Actual exam question from Python Institute's PCAP-31-03
Question #: 48
Topic #: 1
[All PCAP-31-03 Questions]

What is the expected behavior of the following code?

the_string = ',,'.join(('alpha', 'omega'))
the_list = the_string.split(',')
print(',' in the list)

  • A. it outputs False
  • B. it raises an exception
  • C. it outputs True
  • D. it outputs nothing
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
jaycosmo_23
1 month, 3 weeks ago
Selected Answer: A
The expression checks if the string ',' exists as an element in the list. However, ',' is not an element in ['alpha', '', 'omega']. Therefore, the expression evaluates to False.
upvoted 1 times
...
JeyTlenJey
6 months, 2 weeks ago
Selected Answer: B
print(',' in the list) SyntaxError: invalid syntax.
upvoted 1 times
...
kstr
6 months, 4 weeks ago
B the answer
upvoted 1 times
...
DKAT2023
6 months, 4 weeks ago
Selected Answer: B
print(',' in the list) should be : print(',' in the_list)
upvoted 2 times
Dave304409
6 months, 2 weeks ago
excelent
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago