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
In the following switch syntax, the expression is compared with the case labels using which of the following operator(s)?
switch(expression)
{
statements
}The “var” and “function” are __________
When an empty statement is encountered, a JavaScript interpreter __________
What is a block statement in JavaScript?
Which is a more efficient JavaScript code snippet?
Code 1 :
for(var num=10;num>=1;num–)
{
document.writeln(num);
}
Code 2 :
var num=10;
while(num>=1)
{
document.writeln(num);
num++;
}A conditional expression is also called a _______________
What will be the output of the following JavaScript code?
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}
Join The Discussion