Advertisement
DeaD_EyE

names

Jun 28th, 2020
1,446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3.  
  4. names = ["anees", "hatim", "javaid", "munawar", "rafiq", "iqbal", "naqib", "asif"]
  5.  
  6. names_with_r_at_end = []
  7. names_without_r_at_end = []
  8.  
  9.  
  10. for name in names:
  11.     if name.endswith("r"):
  12.         names_with_r_at_end.append(name)
  13.     else:
  14.         names_without_r_at_end.append(name)
  15.  
  16.  
  17. print("Names with r at the end")
  18. print("=======================")
  19. for name in names_with_r_at_end:
  20.     print(name)
  21.  
  22. print()
  23. print("Names without r at the end")
  24. print("==========================")
  25. for name in names_without_r_at_end:
  26.     print(name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement