pub-3785248829033902 | Python: Range | - Big data with Python

| Python: Range |

If range is called with one argument, it produces an object with values from 0 to that argument.

If it is called with two arguments, it produces values from the first to the second.



The best way to learn new things is to take a practical approach of the things you want to learn. Here is a fragment of code that demonstrates the use of the range statement in Python:

Æ’ python command

i = list(range(0, 5))
print(i)

print(range(8) == range(0, 8))
print(range(4) == range(0, 5))

output

[0, 1, 2, 3, 4]
True
False  


Previous
Next Post »