14 lines
291 B
Plaintext
14 lines
291 B
Plaintext
|
# STRING OPERATIONS
|
||
|
# =================
|
||
|
|
||
|
# concatenation with +
|
||
|
assert "hel" + "lo" == "hello"
|
||
|
assert "hello" + " " + "world" == "hello world"
|
||
|
|
||
|
# duplication with *
|
||
|
assert "a" * 3 == "aaa"
|
||
|
assert 4 * "!" == "!!!!"
|
||
|
|
||
|
# bonus
|
||
|
assert ("a" * 2) + "b" == "aab"
|
||
|
assert 4 * ("a" + "b") == "abababab"
|