While learning python, I was messing around with the replace() method and tried making this program:
message = raw_input("Message to find the part of speech: ")
coordconj = "for" or "and" or "nor" or "but" or "or" or "yet" or "so"
print message.replace(coordconj, "coordinating conjunction")
If I run this with the input "name1 for name2". The output is "name1 coordinating conjunction name2" But with "name1 and name2" as the input it prints "name1 and name2"
I also tried:
message = raw_input("Message to find the part of speech: ")
print message.replace("for" or "and" or "nor" or "but" or "or" or "yet" or "so", "coordinating conjunction")
But that didn't work either. It only replaces "for" with "coordinating conjunction". Is there any way to have all words in the variable coorcon
be replaced with "coordinating conjunction" without using a bunch of if statements? Thanks in advance.