Write a Python function to reverse a string if it's length is a multiple of 4.


Topic: Write a Python function to reverse a string if it's length is a multiple of 4.

Solution

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



List all Python Programs