Python Forum
Very Basic String Manipulation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Very Basic String Manipulation
#1
Hello, I'm new to Python and I'm trying to do very basic string manipulation, but I'm a bit stuck.
Method:
1) I input a string, say, "It is my world." ("I understand how to do this")
2) The program searches if any word(s) in the above string is found in a pre-defined list of words ("this too")
Note: For every word in the list, there is an equivalent/synonym ("This I have no idea")
For example, L = ['world' = 'universe']

3) If it is, insert the synonym in place of the original ("no idea")
4) print the result. ("this is straightforward")
5) If not ("this too")
print input()

If you could point me in the right direction, Much appreciated.
Reply


Messages In This Thread
Very Basic String Manipulation - by gstu - Mar-17-2018, 05:29 PM
RE: Very Basic String Manipulation - by j.crater - Mar-17-2018, 06:52 PM
RE: Very Basic String Manipulation - by gstu - Mar-18-2018, 03:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  trying to understand a string literal in a basic server program CompleteNewb 4 2,164 Nov-14-2021, 05:33 AM
Last Post: deanhystad
  IP string manipulation problem TheRealNoob 12 7,415 Feb-04-2019, 09:29 AM
Last Post: perfringo
  string manipulation Avarage_Joe 3 2,637 Sep-19-2018, 09:56 PM
Last Post: woooee

Forum Jump:

User Panel Messages

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