Skip to content

Instantly share code, notes, and snippets.

@ahmed4end
Last active March 3, 2020 20:06
Show Gist options
  • Save ahmed4end/90f767bea9e42018f33fd666910a288f to your computer and use it in GitHub Desktop.
Save ahmed4end/90f767bea9e42018f33fd666910a288f to your computer and use it in GitHub Desktop.
import numpy as np
text = "attack postponed untill two am".replace(' ','')
key = 4312567
sliced = [ int(k) for k in str(key) ]
least_cells = lambda x=1: ( x,len(sliced) ) if x*len(sliced) >= len(text) else least_cells(x+1)
print(np.reshape(np.array(['x']*(lambda x,y: x*y)(*least_cells())) , least_cells()))
#OR
print(np.reshape(np.array(['x']*(least_cells()[0]*least_cells()[1])) , least_cells()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment