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

Danny charges $35 for 3 hours of swimming lesson. Martín charges$24 2 hours of swimming lesson. Who offers a better deal?
which of the following only allows one path for the current to flow through? A. Parallel B. series
Which values of P and Q result in an equation with exactly one solution? 2x+Q=Px−31 Choose all answers that apply: Choose all answers that apply: A -Q=−31 and P
LET ME KNOW IF YOU KNOW!! In 1995 citizens of one Canadian province voted on whether or not to secede from Canada. Which province was this? Question 8 options:
What is the rate of change?
Mrs.Pierce bought a camera that costed 450$ in addition, she had to pay4% on sales tax how much did she pay for the camera
Which expert in the poem expresses the view that death is an enviable state that frees the departed from the miseries of the body and old age?
What’s 1.28 round to the nearest tenth
Use a participial phrase to combine these two sentences into one sentence. The baby was cradled in her mother's arms. The baby was sleeping.
Write the equation in slope intercept form of a line that goes through (4,9) and has a slope of 1/2