[Community Puzzle] Library dependencies

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Rafarafa,validated by @Razovsky,@cedricdd and @Timinator.
If you have any issues, feel free to ping them.

Hi
I tried to solve this puzzle and passed all the validators except 7, @Rafarafa can you share the inputs of the validator? :pleading_face:

It’s pretty much this:

5
import builtins
import unittest
import time
import pandas
import sys
2
pandas requires unittest
unittest requires pandas

My program output:
Import error: tried to import unittest but pandas is required.
Fatal error: interdependencies.
This seems like the right answer, is there something I missed in the statement?

No idea. I will send you the validator 7 by PM because I’m not sure if it’s a spoiler or not. If you think the problem was due to a miss on my part please let me know.

1 Like

No problem in validators as far as i know, everything worked fine for me

Hi,
Great challenge. Having a second(or replace the one you gave that works) visible test case in the directions with an example of what prints if you can reorder would be helpful. I know the directions say what to print, but I was having a hard time understanding what it was asking for. Just a thought.

I’m not sure I understand what you mean. Could you give an example?

Maybe the trouble is on the word “lexicographically”. This means alphabetic order, but not only, it depends on the length of the string.

  • comparing two libraries by character, the first having a smaller character is “lexicographically” smaller
    EX1: itartool is “smaller” than *itertool
    EX2: itertools is “smaller” than j
  • if two librairies have the same character size, the smaller one in size is “lexicographically” smaller
    EX: itertool is “smaller” than itertools

:wave: Hi to all and thanks to @Rafarafa (and @Razovsky, @cedricdd and @Timinator the approvals) for this funny full python-developers-oriented puzzle :wink: !

As said @Razovsky, i had a trouble with the word “lexicographically” (as English is not my native language :man_shrugging:),
→ but i finally could understand what i may do, and i’m now so pleased to get 100% validators for my solution :slight_smile: !

Thanks a lot to you :+1: :handshake:.
:information_source: tip : don’t hesitate to review and upvote my shared solution :wink: ?

It’s the dictionary order.

2 Likes

A few comments after successfully completing:

The instructions make no mention of comma separated dependency lists. That had to be sussed out from the test cases.

When encountering an error and printing out conflict for A requires missing B, it is not clear from the instructions what to do if A also requires missing C. The test cases only accept one of those, but it is not at all clear that is well thought out.

And finally, a minor quibble, but having to parrot back multiple long text strings with mandatory punctuation decreased my enjoyment of the puzzle more than I would have otherwise expected.

You are right about the commas. I added one to test 3 (before it came even later), but I guess it was not enough. I added an explanation of the format in the output section. Note that this comma thingy is just me dealing with CodinGame I/O limitations, it’s not something that I would have done otherwise, it just makes tests shorter.

For the error printing, it’s literally this:

The imaginary compiler will import the libraries in the order that they are given by the puzzle until it finds one that requires a library that was not previously imported.

Even if they happen to be in the same line I don’t see why you wouldn’t apply that logic.

And for the long strings, I’m not a fan myself but they have the advantage of being self-explanatory and making the debugging easier (or at least that was the intention). I fail to see how the punctuation could be annoying though. I just copy pasted the statement when solving it in other languages and that was it.

Regarding the error printing. While the order of importing is stated, we have to give a particular (unimported) dependency. The test assumes an implied order on the dependencies also.

What’s the difference between Test 10 and Validator 10 ? That’s my only fail…
Nice Challenge for me, anyway

None that I can think of, they were both generated by the same random logic. I will send you the validator by pm anyway and you can tell us what went wrong.