Ad
  • Custom User Avatar

    I thought it would be an issue if codewars did something the language's native environment did not do, which is why I flagged it. Restating the solution I posted 5 months ago and not addressing the difference I pointed out between the environments makes it seem like we are discussing different things. I am not asking for assistance with a solution, I am pointing out that codewars added a leading space to an unitilized variable where powershell ise did not.

  • Custom User Avatar

    That is explained in my response from 5 months ago, and the issue is the space is added in codewars but not in powershell ise as shown in the image in the same response?

  • Custom User Avatar

    Do these replies actually notify anyone?

  • Custom User Avatar

    Not sure what your code is, but Xormias is saying that the kata requires you to build a return statement within the function as opposed to printing out the result to the terminal. Additionally many challenges may actually fail if you leave print statements in them due to the way they are built to be checked.

  • Custom User Avatar

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

  • Custom User Avatar

    Are issues only kata specific? I guess this is more towards codewars in general? If the the in-browser ide acts differently compared to a desktop ide...like adding spaces to a return value that was not added when compiled in vscode, what would that be classified as?

  • Custom User Avatar

    I appreciate the response, but just to be clear...youre saying do not use the "/" in repition? Or Dont use the "/" to divide?

  • Custom User Avatar

    Hey, I need some help with the powershell version of this.

    I ran the tests on my function and it passes the tests, but when I click attempt I get the error below.I thought maybe it was an issue with how I truncated the return. But other than [math]::Truncate I just get seemingly an oppostite error like "Expected: {2940} But was: {2941}"

    Can someone take a look and give me a heads up if I caculated something wrong?

    Test Results:
    tank-vol
    Fixed Tests
    Should Pass Fixed Tests
    Expected: {3848}
    But was:  {3847}
    Stack Trace
    Completed in 667ms
    Completed in 667ms
    Random Tests
    Should pass Random Tests
    Completed in 579ms
    Completed in 1245ms 
    
    
    function tank-vol([int]$h, [int]$d, [int]$vt){
        $radius = $d/2
        $radSQD = $radius*$radius
        $length = ($vt/$radSQD)/[MATH]::PI
        $volume = $length*($radSQD*[MATH]::Acos(($radius-$h)/$radius)-(($radius-$h)*[MATH]::Sqrt(2*$radius*$h-$h*$h)))
    
        return [math]::Floor($volume)
    
    
  • Custom User Avatar

    I am having a slight issue, I am using powershell and I have a working function but when I test it in the browser it is adding a leading space. The space doesnt appear when I test it outside the browser, and I verified by checking the length of the return string, I also tried adding trims in a few different places just to force it but it isnt catching it.