Ad
  • Default User Avatar

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

  • 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

    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

    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.