DeaD_EyE

names

Jun 28th, 2020
1,167
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data