Answers for "python range() function in list"

1

python make list from range

# Basic syntax:
your_list = [*range(start, stop, step)]
# Where * is the argument-unpacking operator

# Example usage:
# Say you want to create a list of even numbers ranging from 10-20
[*range(10, 20, 2)]
--> [10, 12, 14, 16, 18]
Posted by: Guest on April-28-2021
1

range() python

#can be used a sequence of numbers
x = range(6)
print(x)
#Outputs 0 1 2 3 4 5

for i in range(start,finish ,step) 
#gives range of numbers
#start is optional default is 0
#finish needed specifying when to stop
#step is incremetntaition of jump also optional
Posted by: Guest on January-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language