Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. """In the first line, print True if has any alphanumeric characters. Otherwise, print False.
  2. In the second line, print True if has any alphabetical characters. Otherwise, print False.
  3. In the third line, print True if has any digits. Otherwise, print False.
  4. In the fourth line, print True if has any lowercase characters. Otherwise, print False.
  5. In the fifth line, print True if has any uppercase characters. Otherwise, print False."""
  6.  
  7. s = "6 omega DOCTOR ##me 12 %$@"
  8.  
  9. alphanumeric = False
  10. alphabetical = False
  11. digits = False
  12. lowercase = False
  13. uppercase = False
  14.  
  15. for l in s:
  16. if l.isalpha():
  17. alphabetical = True
  18. elif l.isdigit():
  19. digits = True
  20. elif l.isalnum():
  21. alphanumeric = True
  22. elif l.islower():
  23. lowercase = True
  24. elif l.isupper():
  25. uppercase = True
  26. else:
  27. pass
  28.  
  29.  
  30. print(alphanumeric)
  31. print(alphabetical)
  32. print(digits)
  33. print(lowercase)
  34. print(uppercase)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement