How does this interaction work within a list?

Asked

Viewed 18 times

1

After searching on how to create lists with random sizes to perform some exercises I found the following line of code that satisfied my doubt but that created another

x = [i + 1 for i in range (Random.randint(9, 15))]

How does the list take only one loop as argument? What is this 'i' variable that starts before the loop? and only there because even when I give the print command , the error that it was not set is released.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.