About 327,000 results
Open links in new tab
  1. python - Using in range (..) in an if-else statment - Stack Overflow

    True so this is perfectly authorized to write x in range(1, 10). As other answers point out, your problem is actually a type problem solved by casting the input data into an integer (as "3" == 3 …

  2. What is the difference between range and xrange functions in …

    240 range creates a list, so if you do range(1, 10000000) it creates a list in memory with 9999999 elements. xrange is a generator, so it is a sequence object is a that evaluates lazily. This is …

  3. python - range () for floats - Stack Overflow

    Dec 6, 2015 · And array (range (5,50,15)) / 10.0 as numpy arrays have operators for handling division, multiplication and so on

  4. Range as dictionary key in Python - Stack Overflow

    Sep 7, 2016 · EDIT: actually it works in Python 3 as range is an immutable sequence type and generate an immutable tuple instead of a list as L3viathan stated. but you cannot access them …

  5. Creating a range of dates in Python - Stack Overflow

    Feb 2, 2012 · A bit of a late answer I know, but I just had the same problem and decided that Python's internal range function was a bit lacking in this respect so I've overridden it in a util …

  6. python - "for loop" with two variables? - Stack Overflow

    Sep 6, 2013 · How can I include two variables in the same for loop? t1 = [a list of integers, strings and lists] t2 = [another list of integers, strings and lists] def f(t): #a function that will read lists "...

  7. Iterating through a range of dates in Python - Stack Overflow

    Jun 30, 2009 · Iterating through a range of dates in Python Asked 16 years, 4 months ago Modified 4 months ago Viewed 608k times

  8. Why is there no xrange function in Python3? - Stack Overflow

    Feb 22, 2013 · Python 3's range type works just like Python 2's xrange. I'm not sure why you're seeing a slowdown, since the iterator returned by your xrange function is exactly what you'd …

  9. How does the Python's range function work? - Stack Overflow

    In such cases you could re-think your design and use while loops, or create objects which implement the "lazy evaluation" semantics of a generator, or use the xrange() version of …

  10. How do I use variables in a loop with range ()? (Python)

    I've been searching for quite a while, and I can't seem to find the answer to this. I want to know if you can use variables when using the range() function. For example, I can't get this to work: l=