Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Backward String by sendhanamudhanmani
def backward_string(val: str) -> str:
# your code here
rev_val = ""
i = len(val) - 1
while i >= 0 :
rev_val += val[i]
i -= 1
return rev_val
if __name__ == '__main__':
print("Example:")
print(backward_string('laugh 😒😊'))
# These "asserts" are used for self-checking and not for an auto-testing
assert backward_string('val') == 'lav'
assert backward_string('') == ''
assert backward_string('ohho') == 'ohho'
assert backward_string('123456789') == '987654321'
print("Coding complete? Click 'Check' to earn cool rewards!")
Feb. 22, 2021
Comments: