Advertisement
Nenogzar

Untitled

Feb 6th, 2024
1,191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. [palindromes.append(string) for string in input_text if string == "".join(reversed(string))]
  2.  
  3. # или
  4.  
  5. palindromes = [string for string in input_text if string == string[::-1]]
  6.  
  7. # което е еквивалентно на:
  8.  
  9. for string in input_text:
  10.     if string == string[::-1]:
  11.  
  12.         palindromes.append(string)
Tags: palindrom
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement