List Loop


#1

I need help creating a list of 20 even number without using if loop but instead for loop

This is what i have soo far
even_list=[]
for i in range(20)

even_list.append()

<do not remove the three backticks above>

#2

if loop does not exist, you mean if keyword or if condition?

we can achieve this with range, looking at the docs about range:

https://docs.python.org/2/library/functions.html#range

the range function has 3 parameters, including a step parameter, that sounds useful


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.