Created
September 30, 2019 08:26
-
-
Save Restioson/a24e00a9213835406ce4ead51666740d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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