adplus-dvertising
frame-decoration

Question

Write a list comprehension equivalent for the code shown below:
for i in range(1, 101):
               	if int(i*0.5)==i*0.5:
                        		print(i)

a.

[i for i in range(1, 100) if int(i*0.5)==(i*0.5)]

b.

[i for i in range(1, 101) if int(i*0.5)==(i*0.5)]

c.

[i for i in range(1, 101) if int(i*0.5)=(i*0.5)]

d.

[i for i in range(1, 100) if int(i*0.5)=(i*0.5)]

Posted under Python

Answer: (b).[i for i in range(1, 101) if int(i*0.5)==(i*0.5)]

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Write a list comprehension equivalent for the code shown below: