Guest User

Untitled

a guest
Nov 18th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. from random import randint
  2.  
  3. s1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
  4.  
  5. def comp(x):
  6. return randint(0,1) if x.isalpha() else x
  7.  
  8. def sc(w):
  9. out = []
  10. calc = list(map(comp,list(w)))
  11. zipped = list(zip(calc,list(w)))
  12. counter = 0
  13. while counter < len(w):
  14. for i in zipped:
  15. if i[0] == 0:
  16. out.append(i[1].lower())
  17. counter += 1
  18. elif i[0] == 1:
  19. out.append(i[1].upper())
  20. counter += 1
  21. else:
  22. out.append(i[0])
  23. counter += 1
  24. return ''.join(out)
  25.  
  26.  
  27. # printer = lambda num: "{}".format(num) * num + "\n"
  28.  
  29. # def pt(n):
  30. # if n < 1:
  31. # return ""
  32. # nums = list(range(1,n+1))
  33. # return list(map(printer,nums[::-1]))
Add Comment
Please, Sign In to add comment