Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Backward String by delahere
def backward_string(val: str) -> str:
# your code here
#
# Convert the string into a list. Reverse the
# order of the elements. Then convert the list
# back into a string using the join() method.
#
val_list = list(val)
val_list.reverse()
rev_val = "".join(val_list)
return rev_val
print("Example:")
print(backward_string("val"))
# These "asserts" are used for self-checking
assert backward_string("val") == "lav"
assert backward_string("") == ""
assert backward_string("ohho") == "ohho"
assert backward_string("123456789") == "987654321"
print("The mission is done! Click 'Check Solution' to earn rewards!")
April 16, 2023
Comments: