Please I'm new to python and I'm trying to understand a line of code. Can someone please explain to me the implications of the addition of the for loop inside brackets with the random integer generator.

Thank you

for i in range( 0, 50 ) :
    ran_values = [ random.randint( 0, 10 ) for i in range( 0, 16 ) ]

This is a list comprehension, google that term for more information. It is the same as doing the following.

for i in range(0,16):

As you can see it requires less code

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.