Python Forum
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list manipulation
#1
I'm trying to make a program that takes any sentence and outputs that same sentence with all the first letters of the words being capitalized. There are exceptions: "and" "not" "the" must be all lowercase as well as any two lettered words.

For example, a string that says 'My name is Mary, not Sally' would output:"my Name is Mary, not Sally".

My strategy is to turn any string into a list of the words and manipulate any exceptions, then add them to the list and put it back to a string again. If there is a more efficient way please let me know.

Screenshots(my progress so far):

https://gyazo.com/20c7af2af42a87d492ef12a31678b657 <-----code
https://i.gyazo.com/a67252ce672d110ca260...fbbea3.png <----output in shell
Reply


Messages In This Thread
list manipulation - by cameronwood611 - Oct-03-2017, 03:40 AM
RE: [HELP] list manipulation - by ichabod801 - Oct-03-2017, 03:44 AM
RE: [HELP] list manipulation - by cameronwood611 - Oct-03-2017, 02:26 PM
RE: list manipulation - by ichabod801 - Oct-03-2017, 02:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem in list manipulation CyKlop 6 2,416 Oct-18-2021, 09:03 AM
Last Post: DeaD_EyE
  How to pass a list by value for manipulation within a process? bRitch022 4 2,818 Jul-09-2020, 07:13 PM
Last Post: bRitch022
  list or dictionary manipulation dtigue 5 121,855 Jul-21-2017, 03:14 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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