import time
def plusravno(copies):
start = time.time()
l = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz0'] * copies
s = ""
for e in l:
s += e
end = time.time()
print("%d strings concatenated in %.3f seconds" % (len(l), end - start))
def tochkajoin(copies):
start = time.time()
l = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz0'] * copies
s = ''.join(l)
end = time.time()
print("%d strings joined in %.3f seconds" % (len(l), end - start))
plusravno(1000000)
tochkajoin(1000000)
aW1wb3J0IHRpbWUKCmRlZiBwbHVzcmF2bm8oY29waWVzKToKCXN0YXJ0ID0gdGltZS50aW1lKCkKCWwgPSBbJ2FiYycsICdkZWYnLCAnZ2hpJywgJ2prbCcsICdtbm8nLCAncHFyJywgJ3N0dScsICd2d3gnLCAneXowJ10gKiBjb3BpZXMKCXMgPSAiIgoJZm9yIGUgaW4gbDoKCQlzICs9IGUKCWVuZCA9IHRpbWUudGltZSgpCglwcmludCgiJWQgc3RyaW5ncyBjb25jYXRlbmF0ZWQgaW4gJS4zZiBzZWNvbmRzIiAlIChsZW4obCksIGVuZCAtIHN0YXJ0KSkKCQpkZWYgdG9jaGtham9pbihjb3BpZXMpOgoJc3RhcnQgPSB0aW1lLnRpbWUoKQoJbCA9IFsnYWJjJywgJ2RlZicsICdnaGknLCAnamtsJywgJ21ubycsICdwcXInLCAnc3R1JywgJ3Z3eCcsICd5ejAnXSAqIGNvcGllcwoJcyA9ICcnLmpvaW4obCkKCWVuZCA9IHRpbWUudGltZSgpCglwcmludCgiJWQgc3RyaW5ncyBqb2luZWQgaW4gJS4zZiBzZWNvbmRzIiAlIChsZW4obCksIGVuZCAtIHN0YXJ0KSkKCQpwbHVzcmF2bm8oMTAwMDAwMCkKdG9jaGtham9pbigxMDAwMDAwKQ==