totoroflvff
totoroflvff totoroflvff
  • 21-01-2021
  • Computers and Technology
contestada

Print even numbers till 50 in python coding.

Respuesta :

Cytokine
Cytokine Cytokine
  • 21-01-2021

In python, you can use a simple list comprehension to solve this problem.

print([x for x in range(51) if x % 2 == 0])

This code prints all the even numbers from 0 to 50 including 0 and 50.

Answer Link

Otras preguntas

Can I get holp on this
What is the inequality shown? n -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9
Why is Bennie crying when Sierra returns? (p. 227)
PLEASE HELP!!!!!Which statement best completes the diagram? (Effects of the Louisiana Purchase)*New territories eventually became 14 new States *Conflicts
find the sum or difference (2/5 + 1/5) - 3/10=
Who was the first woman to be awarded a doctoral degree in psychology?.
The method of encoding information to memory is called ___________. A. retention B. reviewal C. processing D. rehearsal 100 POINTS!! Psychology
In a scale used on blueprint, 14 inch represents 2 feet. On the blueprint what is the length of a room with an actual length of 40 feet? (Hint: /4 = 0.25)
Lab 2. The Gini Index is a measure of how evenly income is distributed to 100. An index of O suggests income is distributed with perfect equality. The higher th
Read the excerpt from Jungle Book: Mowgli's Brothers. "Now," he said, "I will go to men. But first I must say farewell to my mother"; and he went to the cave wh