fork download
  1. examples = '''Spenglerium, Ee
  2. Zeddemorium, Zr
  3. Venkmine, Kn
  4. Stantzon, Zt
  5. Melintzum, Nn
  6. Tullium, Ty'''
  7.  
  8. def main():
  9. for line in examples.splitlines():
  10. test_case = line.split(', ')
  11. print(validate_symbol(test_case[0], test_case[1]))
  12.  
  13. def validate_symbol(element, symbol):
  14. result = False
  15.  
  16. char_1 = [i for i, v in enumerate(element) if v.lower() == symbol[0].lower()]
  17. char_2 = [i for i, v in enumerate(element) if v.lower() == symbol[1].lower()]
  18.  
  19. if char_1 and char_2:
  20. for x in char_1:
  21. for y in char_2:
  22. if x < y: result = True
  23.  
  24. return result
  25.  
  26. if __name__ == '__main__': main()
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
True
True
True
False
False
False