fork download
  1. def splurth(element):
  2. full_name = element.lower()
  3. for x in range(len(full_name)):
  4. for y in range(x+1, len(full_name)):
  5. yield full_name[x].upper() + full_name[y].lower()
  6.  
  7. def blurth(element, prefix=''):
  8. full_name = element.lower()
  9. for x in range(len(full_name)):
  10. yield (prefix + full_name[x]).title()
  11. for name in blurth(full_name[x+1:], prefix + full_name[x]):
  12. yield name.title()
  13.  
  14. def verify_splurth(element, symbol):
  15. return symbol in splurth(element)
  16.  
  17. def first_splurth(element):
  18. return sorted(splurth(element))[0]
  19.  
  20. print('=== MAIN CHALLENGE ===')
  21. print(verify_splurth('Spenglerium', 'Ee'))
  22. print(verify_splurth('Zeddemorium', 'Zr'))
  23. print(verify_splurth('Venkmine', 'Kn'))
  24. print(verify_splurth('Stantzon', 'Zt'))
  25. print(verify_splurth('Melintzum', 'Nn'))
  26. print(verify_splurth('Tullium', 'Ty'))
  27.  
  28. print('=== BONUS 1 ===')
  29. print(first_splurth('Gozerium'))
  30. print(first_splurth('Slimyrine'))
  31.  
  32. print('=== BONUS 2 ===')
  33. print(len(set(splurth('Zuulon'))))
  34.  
  35. print('=== BONUS 3 ===')
  36. print(len(set(blurth('Zuulon'))))
Success #stdin #stdout 0.02s 9944KB
stdin
Standard input is empty
stdout
=== MAIN CHALLENGE ===
True
True
True
False
False
False
=== BONUS 1 ===
Ei
Ie
=== BONUS 2 ===
11
=== BONUS 3 ===
47