Python Forum
Put each word in a quote in a new line in printout
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Put each word in a quote in a new line in printout
#5
Hello,

please see the solution below; Smile
# [ ] Print each word in the quote on a new line  
quote = "they stumble who run fast "
start = 0 
space_index = quote.find(" ")
while space_index != -1: 
    print(quote[start:space_index])
    start = space_index + 1
    space_index = quote.find(" ", space_index + 1)
Reply


Messages In This Thread
RE: Put each word in a quote in a new line in printout - by umarbilal - Apr-15-2019, 06:22 AM

Forum Jump:

User Panel Messages

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