Python Forum
Probelm in displaying char. indexwise
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Probelm in displaying char. indexwise
#1
Hi,
I have started python programming. And my question is related to string .

I wrote below statement
msg=  "Welcome"
print(msg)
I got theoutput as "Welcome" :correct

then,
print(msg[1])
I got the output as "e" : correct

then, I wrote
print(msg[1:3])
I got the output as "el" : I don't understand this

W e l c o m e
0  1 2 3 4 5 6

So, I am expecting the output as elc

then, why it is just showing me "el" ?

Please help me here
Thanks
Reply


Messages In This Thread
Probelm in displaying char. indexwise - by ShailendraRaghunathPhadke - Feb-09-2017, 02:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Sad How to split a String from Text Input into 40 char chunks? lastyle 7 1,269 Aug-01-2023, 09:36 AM
Last Post: Pedroski55
  How to replace on char with another in a string? korenron 3 2,411 Dec-03-2020, 07:37 AM
Last Post: korenron
  How to remove char from string?? ridgerunnersjw 2 2,614 Sep-30-2020, 03:49 PM
Last Post: ridgerunnersjw
  Sum char word dictionary RavCOder 3 2,415 Nov-08-2019, 01:32 PM
Last Post: perfringo
  The use of escape char \ hishamzero1 2 2,428 Aug-12-2019, 10:20 PM
Last Post: hishamzero1
  First non-repeating char and some errors. blackknite 1 2,316 Jan-06-2019, 02:19 PM
Last Post: stullis
  Probelm using Boolean input phrase.isupper() skrivver99 4 3,175 Nov-04-2018, 09:21 AM
Last Post: Larz60+
  json.dumps save some unicode chars as code, not char buran 1 2,973 Aug-02-2018, 04:02 PM
Last Post: buran
  pyserial char by char io fcagney 4 6,374 May-15-2018, 10:45 PM
Last Post: DeaD_EyE
  how to give your data column names based on char position whyme 7 4,501 Oct-27-2017, 06:45 PM
Last Post: heiner55

Forum Jump:

User Panel Messages

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