About 50 results
Open links in new tab
  1. How does the Python's range function work? - Stack Overflow

    The Python range() function simply returns or generates a list of integers from some lower bound (zero, by default) up to (but not including) some upper bound, possibly in increments (steps) of …

  2. python range and for loop understanding - Stack Overflow

    Mar 26, 2022 · 0 I am new to python / coding and looking to understanding the range function more and how it is used in conjunction with the "for" loop. So I know that the range function …

  3. for loop in Python - Stack Overflow

    for k in range(1, c): In Python, which would be identical to

  4. python - How to stop one or multiple for loop (s) - Stack Overflow

    for b in range(..): if some condition: # break the inner loop break else: # will be called if the previous loop did not end with a `break` continue # but here we end up right after breaking the …

  5. python - Loop backwards using indices - Stack Overflow

    I am trying to loop from 100 to 0. How do I do this in Python? for i in range (100,0) doesn't work. For discussion of why range works the way it does, see Why are slice and range upper-bound …

  6. Why does range(start, end) not include end? - Stack Overflow

    You explain that range (x) should start with 0 and x will be the "length of the range". OK. But you didn't explain why range (x,y) should start with x and end with y-1. If the programmer wants a …

  7. Why is looping over range() in Python faster than using a while loop?

    In the while loop, the loop update i += 1 happens in Python, whereas in the for loop again the iterator of range(100000000), written in C, does the i+=1 (or ++i). We can see that it is a …

  8. Print a list in reverse order with range ()? - Stack Overflow

    Sep 2, 2011 · Using "reversed" with python generator (assuming we ware talking of Python 3 range built-in) is just conceptually wrong and teaches wrong habits of not considering …

  9. python - Print range of numbers on same line - Stack Overflow

    Aug 25, 2013 · Using python I want to print a range of numbers on the same line. how can I do this using python, I can do it using C by not adding \\n, but how can I do it using python. for x …

  10. Skip over a value in the range function in python - Stack Overflow

    What is the pythonic way of looping through a range of numbers and skipping over one value? For example, the range is from 0 to 100 and I would like to skip 50. Edit: Here's the code that I'm …