How to solve the Codewars's Data Reverse

Today I try to solve the algorithm problem of codewars.

Description

A stream of data is received and needs to be reversed.

Each segment is 8 bits long, meaning the order of these segments needs to be reversed.

Example

11111111 00000000 00001111 10101010

->

10101010 00001111 00000000 11111111

Code

  • [] : built-in list type.

  • slice : work on lists just as with strings.

def data_reverse(data):
        # Codewars COC 정책으로 인하여 코드 제거
    return arr
Written on December 4, 2018