Download python - How does this "x for x in..." construct work? - Stack Overflow book pdf free download link or read online here in PDF. Read online python - How does this "x for x in..." construct work? - Stack Overflow book pdf free download link book now. All books are in clear copy here, and all files are secure so don't worry about it. This site is like a library, you could find million book here by using search box in the header.
squares = [x*x for x in range(10)] This gives x squared for each x in the specified range. In your example, the second x is the variable used by the for loop, and the first x is simply an expression, which happens in your case to be just x. The expression can be whatever you like, and does not need to be in terms of x.
Read : python - How does this "x for x in..." construct work? - Stack Overflow pdf book online Select one of servers for direct link: |
---|