Print(set("penguin")) | Sololearn: Learn to code for FREE!
0

Print(set("penguin"))

Output is {'e','u','g','e','i','n'} So,Can anyone illustrate what does this code during execution?

18th Apr 2020, 5:39 AM
Narayanasamy Lorshan
Narayanasamy Lorshan - avatar
1 Respuesta
+ 2
You missed the letter p. set() function converts the string to a set of unique characters. Each letter is included only once. Sets are not ordered, so printing them happens in kind of random order.
18th Apr 2020, 5:43 AM
Tibor Santa
Tibor Santa - avatar