What is the expected output of the following code?
What is the expected output of the following code?
print(list(‘hello’))
A . None of the above.
B. hello
C. [h, e, l, l, o]
D. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
E. [‘h’ ‘e’ ‘l’ ‘l’ ‘o’]
Answer: D
Explanation:
Topic: list()
Try it yourself:
print(list(‘hello’)) # [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
A string is a sequence of characters
and works very fine with the list() function.
The result is a list of strings, in which every character is a string of its own.
Latest PCEP-30-01 Dumps Valid Version with 124 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments