Python Forum
''.join and start:stop:step notation for lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
''.join and start:stop:step notation for lists
#2
You were close... Try it like this:

phrase = "Don't panic!"
plist = list(phrase)
 
plist.remove("'")
plist.insert(6,plist.pop(3))
new_phrase = ''.join(plist[1:4] + plist[-5:-8:-1])

print(new_phrase)
ringgeest11 likes this post
Reply


Messages In This Thread
RE: ''.join and start:stop:step notation for lists - by BashBedlam - Apr-08-2021, 04:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Forcing matplotlib to NOT use scientific notation when graphing sawtooth500 4 382 Mar-25-2024, 03:00 AM
Last Post: sawtooth500
  issue with converting a scientific notation to standard notation thomaswfirth 4 1,371 Jun-06-2023, 06:06 PM
Last Post: rajeshgk
  notation MCL169 8 1,484 Apr-14-2023, 12:06 PM
Last Post: MCL169
  Issue in writing sql data into csv for decimal value to scientific notation mg24 8 3,055 Dec-06-2022, 11:09 AM
Last Post: mg24
  Graphics Formatting - X-axis Notation and Annotations - Matplotlib silviover_junior 0 1,792 Mar-17-2021, 01:19 PM
Last Post: silviover_junior
  How to understand the byte notation in python3 blackknite 3 2,919 Feb-23-2021, 04:45 PM
Last Post: bowlofred
  The difference between os.path.join( and os.sep.join( Pedroski55 2 9,467 Nov-17-2020, 08:38 AM
Last Post: Pedroski55
  Split dict of lists into smaller dicts of lists. pcs3rd 3 2,378 Sep-19-2020, 09:12 AM
Last Post: ibreeden
  join string lists redminote4dd 9 3,500 Jun-11-2020, 07:04 PM
Last Post: Yoriz
  Use Python to start/stop a server service via a webform? oakleaf2001 0 1,758 Apr-04-2020, 06:14 AM
Last Post: oakleaf2001

Forum Jump:

User Panel Messages

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