About 52 results
Open links in new tab
  1. What does [:-1] mean/do in python? - Stack Overflow

    Mar 20, 2013 · Working on a python assignment and was curious as to what [:-1] means in the context of the following code: instructions = f.readline()[:-1] Have searched on here on S.O. …

  2. What is the meaning of "int(a[::-1])" in Python? - Stack Overflow

    Jul 26, 2015 · This is some silly code, because the int() call is effectively a no-op (it doesn't do anything), because the result is converted to a string.

  3. string - What does n [::-1] means in Python? - Stack Overflow

    Feb 16, 2015 · I have a string n = "abc". I want to reverse it and found a solution like n[::-1]. What is the meaning of all 3 arguments?

  4. What does string[1:-1] means in python? - Stack Overflow

    Dec 18, 2019 · What does string [1:-1] means in python? [duplicate] Asked 5 years, 11 months ago Modified 5 years, 11 months ago Viewed 17k times

  5. python - What is the difference between i = i + 1 and i += 1 in a …

    Jan 4, 2017 · This is because now C is a 1D array (C.ndim == 1), and so when iterating over C, each integer element is pulled out and assigned to c. Now in Python, integers are immutable, …

  6. syntax - What does :-1 mean in python? - Stack Overflow

    Jan 20, 2013 · You'll notice it's similar to the range arguments, and the : part returns the entire iterable, so the -1 is everything except the last index. Here is some basic functionality of slicing:

  7. Behaviour of increment and decrement operators in Python

    Sep 28, 2009 · Also, be aware that, in Python, += and friends are not operators that can be used in expressions. Rather, in Python they are defined as part of an "augmented assignment …

  8. 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.

  9. list - what does [::-1] mean in python - slicing? - Stack Overflow

    according to this 'b' should be range (5,0,-1). i.e. it should start from 5 and ends at 0. how this (4,-1,-1) came ? The method you used is called Slicing in Python. Slicing syntax in python is as …

  10. syntax - Python integer incrementing with ++ - Stack Overflow

    In Python, you deal with data in an abstract way and seldom increment through indices and such. The closest-in-spirit thing to ++ is the next method of iterators.