11 March 2016 - Forum Rules
Started by Squall_FF8, March 31, 2018, 04:41:30 AM
Quotefor y in range(top_y, bottom_y):
QuoteThe ''range'' is seen so often in for statements that you might think range is part of the for syntax. It is not: it is a Python built-in function which returns a sequence, which meets the requirement of providing a sequence for the for statement to iterate over.
Quoterange() (and Python in general) is 0-index based, meaning list indexes start at 0, not 1. eg. The syntax to access the first element of a list is mylist. Therefore the last integer generated by range() is up to, but not including, stop. For example range(0, 5) generates integers from 0 up to, but not including, 5.
Quote from: Squall_FF8 on March 31, 2018, 05:43:53 AMIt seems it doesn't include the right boundary so this is where my mistake was
Quote from: Disch on March 31, 2018, 12:14:39 PMTo clarify: 'for' iterates over every element in the sequence you give it.'range' generates a sequence which excludes the upper-bound
Quote from: Squall_FF8 on March 31, 2018, 12:50:59 PMP.S. Hi Disch, long time no see I'm glad that you are still active! Its been like 2 years since we worked together. Are you still doing NES projects or ...?
Page created in 0.318 seconds with 19 queries.