Random permutation alphabet
Write a Python procedure, randomPermAlphabet(msg), that produces a random permutation of the alphabet string. This procedure will be useful in future exercises involving substitution ciphers.
(HINT) The job can be simplified enormously by using the numpy.random.permutationfunction of the NumPy. (https://docs.scipy.org/doc/numpy-1.3.x/reference/generated/numpy.random.permutation.htm
import random
def randomPermAlphabet(msg):
#using sample to shuffle
return ''.join(random.sample(msg,len(msg)))
print(randomPermAlphabet("Uday"))
print(randomPermAlphabet("Hello213"))
print(randomPermAlphabet("uday123Kumar"))
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Get Answers For Free
Most questions answered within 1 hours.