my code

Snippet options

Download: Download snippet as
Copy snippet: For this you need a free my code account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

print("Napis dve slova a poviem ti ci su anagramy")
first_word = input("Napiste prve slovo")
second_word = input("Napiste druhe slovo")

def is_anagram(fw, sw):
  return sorted(fw.lower()) == sorted(sw.lower())

if is_anagram(first_word, second_word):
  print("Slova su anagramy")
  print("Slova nie su anagramy")
Tie ponukanie postupy rieseni v zadaniach su velmi zle. Napriklad pri tomto
bolo napisane ze sa ma najprv porovnat dlzka stringov a potom pocet pismen.
Preco ale radia taketo komplikovane riesenie? Vzdy je cielom vymyslet to co
najjednoduchsie a najkratsie, nie najzlozitejsie a najkomplikovanejsie

Ja to mam tak ze sa slovo jednoducho da najprv do lowercase nech sa nemusi neskor
riesit rozdiel medzi AHOJ a ahoj. Potom zoradim tie slova a cisla v tom stringu
podla ich abecedneho a ciselneho poradia a potom sa uz jednoducho len porovnaju.

Create a free my code account now.

my code is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.