Skip to content

Instantly share code, notes, and snippets.

@Restioson
Created September 30, 2019 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Restioson/a24e00a9213835406ce4ead51666740d to your computer and use it in GitHub Desktop.
Save Restioson/a24e00a9213835406ce4ead51666740d to your computer and use it in GitHub Desktop.
def transform(last):
"""Transforms the last sentence of disagreement into the next"""
# Strip the "I disagree with..." part from the setence, so that
# we can work with just chains of "[your|my] disagreement of..."
next = last[len("I disagree with "):]
# Rotate your <-> my
next = next.replace("your", "p_my")
next = next.replace("my", "p_your")
next = next.replace("p_my", "my")
next = next.replace("p_your", "your")
# Prepend the "I disagree with..." and add one more term of disagreement
next = "I disagree with your disagreement of " + next
return next
def term(n):
"""Get the nth sentence of disagreement, where n is incremented for both speakers turns"""
# Opening part
s = "I disagree with your disagreement "
for i in range(n):
# Alternate between "my" and "your"
s += "of your disagreement " if i % 2 == 1 else "of my disagreement "
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment