What is the output of print(k) in the following Python code snippet?
k = [print(i) for i in my_string if i not in “aeiou”]
print(k)
a) all characters of my_string that aren’t vowels
b) a list of Nones
c) list of Trues
d) list of Falses
Answer: b
Explanation: print() returns None.
Related Posts
What will be the output of the following Python code?
>>> a=[(2,4),(1,2),(3,9)]
>>> a.sort()
>>> aIs the following Python code valid?
>>> a=(1,2,3)
>>> b=a.update(4,)What will be the output of the following Python code?
>>> a=(2,3,1,5)
>>> a.sort()
>>> aIs the following Python code valid?
>>> a=2,3,4,5
>>> aTuples can’t be made keys of a dictionary.
What will be the output of the following Python code?
>>> import collections
>>> a=collections.namedtuple(‘a’,[‘i’,’j’])
>>> obj=a(i=4,j=7)
>>> objWhat will be the output of the following Python code?
>>> a,b=6,7
>>> a,b=b,a
>>> a,b
Join The Discussion