Python range() function to generate a range of numbers with start stop and step values

preview_player
Показать описание
Range() function will return us range object and by using this we can print a range of numbers.

Out of the three inputs , stop value is required and other two values start and step are optional. The default value for start is 0 and for step is 1. If one input is given then it is considered as stop value. The range values will stop before it reaches the end value.

X=range(5)
Print(list(X))
We can use a list to create an range object.
my_list=[5,40,10]
We can unpack this my_list and use it to create a range.
We can use negative numbers but can’t use float or string to create a range.

#pythonrange #pythonrangelist #forlooprange
Рекомендации по теме
Комментарии
Автор

Thankss, that'll help me in my computer exam.

callhereddy