This is a proof-of-concept for writing Python koans in an IPython notebook, based on the original about strings koan.
# replace the __ with an equality operator (like == or !=)
string = "Hello, world."
assert type(string) __ str
# replace the __ with an equality operator (like == or !=)
string1 = 'Goodbye, world.'
string2 = "Goodbye, world."
assert string1 __ string2
# fix the syntax error
print "Goodbye, world.'
# fix the syntax error
print 'Goodbye, world."
# replace the __ with an equality operator (like == or !=)
string1 = """Howdy, world!"""
string2 = 'Howdy, world!'
assert string1 __ string2
# fix the syntax error
print """Howdy, world!"""
print ""Howdy, world!""
print "Howdy, world!"
# replace the __ with an equality operator (like == or !=)
string = '''Bonjour tout le monde!'''
string = "Bonjour tout le monde!"
assert string1 __ string2
# fix the syntax error
print '''Bonjour tout le monde!'''
print ''Bonjour tout le monde!''
print 'Bonjour tout le monde!'
# fix the syntax error
print '''Bonjour tout le monde!"""
# replace the __ with an equality operator (like == or !=)
string = r"Konnichi wa, world!"
string = "Konnichi wa, world!"
assert string1 __ string2
# replace the __ with an equality operator (like == or !=)
a = "He said, \"Don't\""
b = 'He said, "Don\'t"'
assert a __ b
# replace the __ with an equality operator (like == or !=)
a = "He said, \"Don't\""
b = 'He said, \'Don"t\''
assert a __ b
# replace the __ with an equality operator (like == or !=)
a = "He said, 'Don\"t'"
b = 'He said, "Don\'t"'
assert a __ b
# fix the syntax error
print "He said, "Go Away.""
# fix the syntax error
print 'He said, 'Go Away.''
# fix the syntax error
print 'He said, "Don't"'
# replace the __ with an equality operator (like == or !=)
a = "Hello \"world\"."
b = """Hello "world"."""
assert a __ b
# fix the syntax error (hint: escape one of the quotes)
print """Hello "world""""
# replace __ with the length of the string
string = "\n"
assert '\n' == string
assert """\n""" == string
assert __ == len(string)
# replace __ with the length of the string
string = "\t"
assert '\t' == string
assert """\t""" == string
assert __ == len(string)
# replace __ with the length of the string
string = "\m"
assert '\m' == string
assert """\m""" == string
assert __ == len(string)
# replace the __ with an equality operator (like == or !=)
string1 = "It was the best of times,\n\
It was the worst of times."
string2 = """It was the best of times,
It was the worst of times."""
assert string1 __ string2
# replace the __ with an equality operator (like == or !=)
string1 = "It was the best of times,\n\
It was the worst of times."
string2 = "It was the best of times, It was the worst of times."
assert string1 __ string2
# fix string1 or string2 so the test passes
string1 = "It was the best of times,\
It was the worst of times."
string2 = "It was the best of times, It was the worst of times."
assert string1 == string2
# replace the __ with an equality operator (like == or !=)
string1 = "It was the best of times,\n\
It was the worst of times."
string2 = """It was the best of times,\n\
It was the worst of times."""
assert string1 __ string2
# replace the __ with an equality operator (like == or !=)
string1 = "\nHowdy,\nworld!\n"
string2 = """
Howdy,
world!
"""
assert string1 __ string2
# replace the __ with an equality operator (like == or !=)
string1 = "\n Howdy,\n world!\n"
string2 = """
Howdy,
world!
"""
assert string1 __ string2
# replace the __ with an equality operator (like == or !=)
string1 = "\n\
Howdy,\n\
world!\n\
"
string2 = """
Howdy,
world!
"""
string1 __ string2
# replace __ with a string
string = "Hello, " + "world"
assert __ == string
# replace __ with a string
string = "Hallo" ", " "Welt"
assert __ == string
# replace __ with strings
hi = "Hello, "
there = "world"
string = hi + there
assert __ == hi
assert __ == there
assert __ == string
# replace __ with strings
hi = "Hello, "
there = "world"
hi += there
assert __ == hi
assert __ == there
# replace __ with strings
original = "Hello, "
hi = original
there = "world"
hi += there
assert __ == original
assert __ == hi
assert __ == there