Draft

Periodic Table Decoder

Description
Loading description...
Algorithms
Strings
Parsing
Regular Expressions
  • Please sign in or sign up to leave a comment.
  • Blind4Basics Avatar

    Well, I have to say... This is quite poorly designed, sorry... :-s

    • the name of the dictionnary isn't enough visible (I add to read a second time the text to find it). You should put it in the example block (in the description), that's especially the right place for it.
    • this dict being a constant, it should be named ELEMENTS
    • wrong information in description: Doesn't exist is expected, not Does not exist
    • you ask for 2 functions, encode and decode, but you provide only one, named decode... And that is supposed to encode too. That's quite confusing and bad practice (and illogical)!
    • useless link in the description (link to a draft. Seems you fused both katas in the present one)

    I was happy to do a kata about chemistry but it was somehow a painfull experience, finally... ;-/

    • AcesOfGlory Avatar

      Apologies, I made this a year ago when I was still a noob coder and haven't changed the Kata since. I'll take this off beta into draft and will maybe improve it when I can be bothered. Thanks for the feedback, Blind!

  • daddepledge Avatar

    One of the test cases is 'Carbonite' My code translates this as a valid list of chemical symbols, but get the message

    'Carbon Argon Boron Oxygen Nitrogen Iodine Tellurium' should equal "Doesn't exist"

    Have I misunderstood something or is the test case wrong?

    A really good Kata, liked the other periodic table one too.

    • daddepledge Avatar

      I had misunderstood something. I was allowing case variation. If I use the case of the letters in the supplied string I get the correct answers.

      Sorry & thanks.

  • sperry Avatar

    There are misprints in basic test cases: Test.assert_equals(decode("NaNaNaNaNa", "Sodium Sodium Sodium Sodium Sodium") instead of Test.assert_equals(decode("NaNaNaNaNa"), "Sodium Sodium Sodium Sodium Sodium") and Test.assert_equals(decode("Sodium Sodium Sodium Sodium Sodium", "NaNaNaNaNa") instead of Test.assert_equals(decode("Sodium Sodium Sodium Sodium Sodium"), "NaNaNaNaNa"). To make the kata harder, you could mix elements and symbols in the input string. Anyway, nice kata, thanks!