Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python make a list of odd numbers

odd_list = []
for a in range(10):
    if a % 2 != 0:
        odd_list.append(a)

print(odd_list)
Comment

python make a list of odd numbers

odd_list = []
for a in range(1, 10, 2):
    odd_list.append(a)

print(odd_list)
Comment

how to create a list of even numbers in python

start_ = 0 # start from 
list_size = 10 # end at 
even_list = [i*2 for i in range(start_ , list_size)] # even numbers list
print(even_list) # printing list
Comment

PREVIOUS NEXT
Code Example
Python :: pyhton regex to find string in file 
Python :: python center window 
Python :: blank=True 
Python :: flask send client to another web page 
Python :: dropping nan in pandas dataframe 
Python :: download a file from url python 
Python :: pthon - progressbar 
Python :: how to add 30 minutes in datetime column in pandas 
Python :: create python file kali linux 
Python :: how to create a role and give it to the author discord.py 
Python :: how many days until 2021 
Python :: get list of files in directory python 
Python :: generics python 
Python :: how to create random tensor with tensorflow 
Python :: tkinter new line in text 
Python :: escape brackets in f string 
Python :: python day of the week 
Python :: how to sort dictionary in python by lambda 
Python :: plt change grid color 
Python :: pandas reorder columns by name 
Python :: how to use with open 
Python :: jupyter nbconvert 
Python :: python mysqlclient not installing 
Python :: how to commenbt code in python 
Python :: numpy standard deviation 
Python :: pyqt5 button example 
Python :: python get dictionary keys 
Python :: sum of column in 2d array python 
Python :: python - remove duplicate items from the list 
Python :: root template 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =