def palindrome(word):
"""Return True if the given word is a palindrome."""
return word == word[::-1]
#Retrieve the docstring with __doc__
print(repr(palindrome.__doc__))
'Return True if the given word is a palindrome.'
"""
)# words.py
#!/usr/bin/env python3
"""Library for testing words for various linguistic patterns.
Testing how words relate to each other can be tricky sometimes!
This module provides easy ways to determine when words you’ve
found have special properties.
Available functions:
- palindrome: Determine if a word is a palindrome.
- check_anagram: Determine if two words are anagrams.
"""
print()
class Player(object):
"""Represents a player of the game.
Subclasses may override the ‘tick’ method to provide
custom animations for the player’s movement depending
on their power level, etc.
Public attributes:
- power: Unused power-ups (float between 0 and 1).
- coins: Coins found during the level (integer).
"""
def __init__():
self._power = 0
self._coins = 0
return
@property
def coins():
return self._coins
@coins.setter
def coins(value):
if value < 0:
raise ValueError("Can't be less than 0")
self._coins = value
def find_anagrams(word, dictionary):
"""Find all anagrams for a word.
This function only runs as fast as the test for
membership in the ‘dictionary’ container. It will
be slow if the dictionary is a list and fast if
it’s a set.
Args:
word: String of the target word.
dictionary: Container with all strings that
are known to be actual words.
Returns:
List of anagrams that were found. Empty if
none were found.
"""
return