I am quite new to python. Can someone explain this line
exec("print(' '.join(map(lambda x: s[x::{0}], range({0}))))".format(ceil(sqrt(len(s)))))
What does s[x::{0}]
and range({0}))
mean ?
in below piece of code in detail?
This code is a solution for below hackerrank question : https://www.hackerrank.com/challenges/encryption/problem
#!/bin/python3
import sys
from math import ceil, floor, sqrt
def encryption(s):
exec("print(' '.join(map(lambda x: s[x::{0}], range({0}))))".format(ceil(sqrt(len(s)))))
if __name__ == "__main__":
s = input().strip()
result = encryption(s)