Ad
  • Custom User Avatar

    are you an arabic my friend

  • Custom User Avatar

    OP solved it, closing

  • Default User Avatar

    My solution found isPP(92429 ** 10) in 4 loops.

  • Default User Avatar

    It is a waste of time in the sense that you are at best trying to rely on undefined behaviour, but I don't think the version is the difference at all, but rather that you are running the test differently.

    0.0 is 0.0 typically evaluates to True, but if you obtain 0.0 from two different modules those may be separate values.

    Testing whether you receive THE SAME ONE 0.0 is a very very strange thing and probably isn't even what you mean to do.

    What you're supposed to test is whether both are 0.0, not whether they're the same 0.0

    0 happens to be different only because cpython keeps a single instance of it. you still shouldn't make that comparison though.

  • Custom User Avatar
  • Default User Avatar

    As my comment is marked as spoiler, I cannot see it anymore. But I will try to remember what I wrote.
    It worked in codewars with all tests but the one with 0 and 0.0. Then I tried the one that failed (with 0 and 0.0) in pycharm with 3.8 to find out what was wrong and it worked.
    I was reading the "what's new in Python 3.8" documentation to understand, but I realised it would take a lot of time to read (and specially understand) everything.
    I was thinking about installing the 3.6 version to make some tests with pycharm, because it gives a lot of clues, to understand the problem.
    Do you think it is a good approach or a waste of time?
    Thank you for your time.

  • Default User Avatar

    This does not pass all tests with 3.8, maybe you mean some tests but some is not all.
    In particular, python does not promise that there exists only one 0 and one 0.0. For cpython this is true for 0 (though the language does not promise it, so you shouldn't) but is not true for 0.0 so you both shouldn't and can't.

  • Default User Avatar

    Found the problem. I should have used "except IndexError:"
    I did not even know the error could be specified. I am reading a book were the guy uses bare except. I will stop reading it. hahaha

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Your warning message provides a reference that you can google to answer your own question.

  • Default User Avatar

    I am a begginer, but I think it is not necessary to create a list.
    I solved it with a index counter and used try/except to deal with the last letter. However, pycharm says "too broad exception clause/ PEP 8: E722 do not use bare 'except'".
    Can someone explain why it is not best pŕactices and why the exception is too broad?

  • Default User Avatar

    I think dict[c-1] raises an error, since c is 'str' and 1 is 'int'.
    But I think you meant roman.index[c-1] because I tried this. It did not work because in 'MCMXC', for example, on the second 'M' c is stored as 'M' in memory. Then it will search for the index of 'M' and find the first one, which is 0.