Ad
  • Custom User Avatar
  • Custom User Avatar

    Agreed.

  • Custom User Avatar

    You have equalateral, but it should be equilateral.

  • Custom User Avatar

    Still a complete duplicate without any originality.

  • Custom User Avatar

    Here at Codewars, we ensure that only the VERY BEST code is able to pass my tests.

    Just kidding, redundancy. I don't know how, but if somehow you managed to make your code return true 49 out of 50 times this would catch you. ;)

    Is it really necessary? Probably not. Does it affect the tests in any impactful way? No.

  • Custom User Avatar

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

  • Custom User Avatar

    Thank you, I have very small brain! I understand now! :)

  • Custom User Avatar

    I have now realized that rather than checking the value of the input passed, it checks for the value of the variable s, even if it does not exist in my code...

    #<NameError: undefined local variable or method `s' for main:Object>
    main.rb:6:in `zero_and_one'
    main.rb:14:in `block (2 levels) in <main>'
    /runner/frameworks/ruby/cw-2.rb:180:in `wrap_error'
    /runner/frameworks/ruby/cw-2.rb:72:in `it'
    /runner/frameworks/ruby/cw-2.rb:206:in `it'
    main.rb:13:in `block in <main>'
    /runner/frameworks/ruby/cw-2.rb:55:in `block in describe'
    /runner/frameworks/ruby/cw-2.rb:46:in `measure'
    /runner/frameworks/ruby/cw-2.rb:51:in `describe'
    /runner/frameworks/ruby/cw-2.rb:202:in `describe'
    main.rb:12:in `<main>'
    

    This is what happened when I used x and y as my variables.

  • Custom User Avatar

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

  • Custom User Avatar
    Testing for:       
    s = "11"      
    Correct result should be: 14
    Expected: 14, instead got: 2
    
    Testing for:       
    s = "11"      
    Correct result should be: 12
    Expected: 12, instead got: 2
     
    Testing for:       
    s = "1111111"      
    Correct result should be: 11
    Expected: 11, instead got: 7
    
    Testing for:       
    s = "0"      
    Correct result should be: 7
    Expected: 7, instead got: 1
    

    This is happening in ruby and, needless to say, I am very confused. Am I misunderstanding what the problem wants? I am not mutating the input, as you can see in my code below, and it passes the basic tests with no issue.

  • Custom User Avatar

    Works like a charm, thank you!

  • Custom User Avatar

    Uhhhhh...

    undefined method `^' for 2.3230573125418772e-07:Float (NoMethodError)
    
  • Custom User Avatar

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

  • Custom User Avatar

    Ruby:

    Fixed tests
    Test Passed: Value == 8
    Test Passed: Value == 1
    Test Passed: Value == -125
    Test Passed: Value == 16
    Test Passed: Value == 0.0625
    Random tests
    Expected: -1.0000000000000002e-07, instead got: -1.0e-07
    Expected: 1.0240000000000003e-07, instead got: 1.024e-07
    Expected: 5.0805263425290864e-05, instead got: 5.080526342529086e-05
    Expected: 5.120000000000001e-07, instead got: 5.12e-07
    Expected: -5.0805263425290864e-05, instead got: -5.080526342529086e-05
    Expected: 0.00015241579027587256, instead got: 0.00015241579027587258
    Expected: 0.00015241579027587256, instead got: 0.00015241579027587258
    Expected: 6.400000000000001e-05, instead got: 6.4e-05
    Expected: -2.5811747917131966e-09, instead got: -2.581174791713197e-09
    Expected: 1.0000000000000003e-09, instead got: 1.0e-09
    Expected: -5.0805263425290864e-05, instead got: -5.080526342529086e-05
    

    Needs a standard of some sort for floats.

  • Custom User Avatar

    I believe that I have fixed the issue, if you don't have any problem executing your code please let me know so that I may mark it as resolved.

  • Loading more items...