Q:

Write a Python function to reverses a string if its length is a multiple of 4

0

Write a Python function to reverses a string if its length is a multiple of 4

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def reverse_string(str1):
    if len(str1) % 4 == 0:
       return ''.join(reversed(str1))
    return str1

print(reverse_string('abcd'))
print(reverse_string('python'))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now