Python Forum
Beginner's String Operation question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner's String Operation question
#2
'e' is not being counted becuase it's outside of the [0:5] range, not because it is an odd number. It may be a bit confusing until you memorize how slicing works. If you slice an iterable variable with [begin:end], begin indexed item is included, while the end one is not. If you have [0:4], you can understand it as 4 items being selected, if that helps.
Reply


Messages In This Thread
Beginner's String Operation question - by docboy - Sep-30-2018, 05:05 PM
RE: Beginner's String Operation question - by j.crater - Sep-30-2018, 05:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner Python Question: FIzz Buzz using while loop camoyn13 2 1,872 Sep-20-2022, 09:00 AM
Last Post: deanhystad
  NOT bit-wise operation question ajayachander 2 2,057 Jan-27-2020, 08:03 AM
Last Post: ajayachander
  *Ultra beginner math question Markg2 2 2,279 Apr-21-2019, 11:24 PM
Last Post: Markg2
  Beginner Python Homework Question (Calculate Gross Pay) matchamochi7 4 5,749 Nov-02-2018, 01:06 PM
Last Post: buran
  String to Floating Point Question Babbare 2 3,190 May-14-2017, 01:35 AM
Last Post: Babbare

Forum Jump:

User Panel Messages

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