Python Forum
string slicing default value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
string slicing default value
#1
If a slice with positive step like
[::1]
then the default value of starting point and ending point is
[0:len(list):1]
but the default values for negative step like [::-1] is
[len(list)-1:None:-1]
Is that right ? Correct me if i'm wrong please, and are there some mechanisms explain why python can switch between default values like that ? Thank you guys so much
Reply


Messages In This Thread
string slicing default value - by Uchikago - Jul-01-2019, 09:30 AM
RE: string slicing default value - by perfringo - Jul-01-2019, 11:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python3 string slicing Luchano55 4 530 Feb-17-2024, 09:40 AM
Last Post: Pedroski55
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,385 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  String slicing and loop iteration divyansh 9 4,614 Jun-07-2020, 10:29 PM
Last Post: divyansh
  String slicing divyansh 6 3,278 May-31-2020, 06:15 AM
Last Post: pyzyx3qwerty
  string slicing help oli_action 2 2,148 Mar-22-2020, 09:57 AM
Last Post: oli_action
  Accepting strings as arguments when slicing a string? (Ziyad Yehia on Udemy) Drone4four 4 3,716 Aug-23-2019, 07:59 PM
Last Post: Drone4four
  string slicing Uchikago 2 2,331 Jun-28-2019, 06:35 AM
Last Post: perfringo
  String slicing in python from reverse ift38375 1 2,358 Apr-29-2019, 06:58 AM
Last Post: perfringo
  String Slicing in List Comphrensions Patroclus72790 1 2,223 Mar-21-2019, 09:33 PM
Last Post: nilamo
  String slicing problem Ollew 4 2,742 Sep-08-2018, 08:07 PM
Last Post: Ollew

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020