Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- s1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
- def comp(x):
- return randint(0,1) if x.isalpha() else x
- def sc(w):
- out = []
- calc = list(map(comp,list(w)))
- zipped = list(zip(calc,list(w)))
- counter = 0
- while counter < len(w):
- for i in zipped:
- if i[0] == 0:
- out.append(i[1].lower())
- counter += 1
- elif i[0] == 1:
- out.append(i[1].upper())
- counter += 1
- else:
- out.append(i[0])
- counter += 1
- return ''.join(out)
- # printer = lambda num: "{}".format(num) * num + "\n"
- # def pt(n):
- # if n < 1:
- # return ""
- # nums = list(range(1,n+1))
- # return list(map(printer,nums[::-1]))
Add Comment
Please, Sign In to add comment