Ad
  • Custom User Avatar

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

  • Default User Avatar

    that function thing is making it look so hard.

  • Custom User Avatar

    Funny one, "no more hints" on sample tests is actually helpful even if it hurts, as it makes you focus on your code and write exactly what you want rather than just hotfixing until the code passes everything.

  • Custom User Avatar

    I don't think this is 6kyu.

  • Default User Avatar

    Kind of. You're expanding the content of the variable, but if that has spaces then you've passed multiple arguments instead of a single argument:

    txt="a  b c"
    # echo $txt
    echo a  b c
    # echo's arguments (which includes its own name): ["echo", "a", "b", "c"]
    # note no spaces at all. the reason a space is there in the output is that
    # echo is putting a space between each arg when it prints them back out
    
    # echo "$txt"
    echo "a  b c"
    # echo's arguments: ["echo", "a  b c"]
    
  • Default User Avatar

    It wouldn't, but you need to make sure you're not splitting up the text into arguments anywhere, because then you've lost the delimiters.

  • Default User Avatar

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

  • Default User Avatar

    I don't see this behaviour in the tests. It's probably your code that is removing spaces, which is a very easy mistake to make in shell.

    Something is printing to stdout, not sure what (because I'm unfamiliar with cw's sh environment), but I noticed that two spaces look a lot like one space, it doesn't even add a single pixel for the second space. It's there if copied though. Kind of unfortunate font behaviour..

  • Default User Avatar

    The random tests for the Shell implementation appears to occasionally add extra spaces to the output.
    Encoded message: tvg3swhprr hj,

    Test Failed
    expected: "tvg3swhprr  hj,"
         got: "tvg3swhprr hj,"
    
  • Default User Avatar

    approved

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Approved

  • Custom User Avatar
  • Default User Avatar

    you can just print the input

    def check_coupon(entered_code, correct_code, current_date, expiration_date):
        print(entered_code)
        print(correct_code)
        print(current_date)
        print(expiration_date)
        print()
        # your code here
    
  • Loading more items...