What will be the output of the following Python code? l=["good", "oh!", "excellent!", "#450"] [n for n in ...
View Question
What will be the output of the following Python list comprehension?
[j for i in range(2,8) for j in range(i*2, 50, i)]
What will be the output of the following Python list comprehension? [j for i in range(2,8) for j ...
View Question
What is the list comprehension equivalent for?
{x : x is a whole number less than 20, x is even} (including zero)
What is the list comprehension equivalent for? {x : x is a whole number less than 20, x ...
View QuestionWrite a list comprehension to produce the list: [1, 2, 4, 8, 16……212].
a) [(2**x) for x in range(0, 13)] b) [(x**2) for x in range(1, 13)]
View Question
What is the list comprehension equivalent for:
list(map(lambda x:x**-1, [1, 2, 3]))?
What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))? a) ...
View Question
Write a list comprehension equivalent for the Python code shown below.
for i in range(1, 101):
if int(i*0.5)==i*0.5:
print(i)
Write a list comprehension equivalent for the Python code shown below. for i in range(1, 101): if int(i*0.5)==i*0.5:
View QuestionWrite a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.
a) [x in range(1, 1000) if x%3==0] b) [x for x ...
View Question
What will be the output of the following Python code?
t=32.00
[round((x-32)*5/9) for x in t]
What will be the output of the following Python code? t=32.00 [round((x-32)*5/9) for x in t] a) ...
View Question
What will be the output of the following Python code?
[ord(ch) for ch in ‘abc’]
What will be the output of the following Python code? [ord(ch) for ch in 'abc'] a) ...
View Question
Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]
w=”hello”
v=(‘a’, ‘e’, ‘i’, ‘o’, ‘u’)
Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]
View Question