About 50 results
Open links in new tab
  1. What's the difference between "2*2" and "2**2" in Python?

    The top one is a "power" operator, so in this case it is the same as 2 * 2 equal to is 2 to the power of 2. If you put a 3 in the middle position, you will see a difference.

  2. What is :: (double colon) in Python when subscripting sequences?

    Aug 10, 2010 · In Python 3, your example range (N) [::step] produces a range object, not a list. To really see what is happening, you need to coerce the range to a list, np.array, etc.

  3. slice - How slicing in Python works - Stack Overflow

    Python slicing is a computationally fast way to methodically access parts of your data. In my opinion, to be even an intermediate Python programmer, it's one aspect of the language that it is necessary to …

  4. Difference between "//" and "/" in Python 2 - Stack Overflow

    When applied to integers in Python 2.x, / and // are exactly the same. Try the same test in Python 3.x and prepare for a surprise. Having two operators was a way of preparing for the future.

  5. python 2 instead of python 3 as the (temporary) default python?

    Aug 30, 2011 · on my computer ~$ python -V Python 3.2.1 but I get into problems when I run some python programs. my guess is (or at least I want to try this) that there is some backward compatibility …

  6. math - `/` vs `//` for division in Python - Stack Overflow

    Aug 23, 2024 · In Python 3.x, 5 / 2 will return 2.5 and 5 // 2 will return 2. The former is floating point division, and the latter is floor division, sometimes also called integer division. In Python 2.2 or later …

  7. How to install Python 2 on macOS 12.3+ - Stack Overflow

    Apr 4, 2022 · Python Deprecations Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead. (39795874) I understand we need to migrate …

  8. What is the result of % (modulo operator / percent sign) in Python?

    9 divided by 2 is equal to 4. 4 times 2 is 8 9 minus 8 is 1 - the remainder. Python gotcha: depending on the Python version you are using, % is also the (deprecated) string interpolation operator, so watch …

  9. syntax - What do >> and << mean in Python? - Stack Overflow

    Apr 3, 2014 · I notice that I can do things like 2 << 5 to get 64 and 1000 >> 2 to get 250. Also I can use >> in print: print >>obj, "Hello world" What is happening here?

  10. How do you switch between python 2 and 3, and vice versa?

    Dec 2, 2010 · The default system python is 2.6, and python3 is installed as an additional package. ... similarly, on Windows, I have 2.6 and 3.1 installed (in C:\Python26 and C:\Python31) easy to switch …