0
When we write: numbers = range(10) print(numbers) the output is: range(0,10) Why?
5 Answers
+ 1
It creates a random number between 0 and 10. It defaults to 0 because you didn't specifiy the min range.
+ 1
range(10) in Python is an object, the generator to be precise. it is not "random number". to get the numbers that this generator is supposed to create you need
numbers = list (range ( 10 ) )
0
numbers = list(range(10))
print(numbers)
FYI this example in jupyter will give a list call error not the correct code to teach
0
Write a sample c program that will display 10