Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
16th - For using StringIO keyword solution in Creative category for Funny Addition by H0r4c3
from io import StringIO
def checkio(data):
'''
For using StringIO keyword
'''
# Create a StringIO object
string_buffer = StringIO()
sum = 0
for item in data:
string_buffer.write(str(item))
buffer_contents = string_buffer.getvalue()
sum += int(buffer_contents)
string_buffer.truncate(0)
string_buffer.seek(0)
string_buffer.close()
return sum
if __name__ == '__main__':
assert checkio([5, 5]) == 10, 'First'
assert checkio([7, 1]) == 8, 'Second'
print('All ok')
April 30, 2023