Ad
  • Custom User Avatar

    My python code works in VSCode. On Codewars I get an Exit Code: 137, Max Buffer Size Reached (1.5 MiB). Removing the print() used for debug did the trick.

  • Custom User Avatar

    Thank you benjaminzwhite,
    i'm wondering why greet(Paul) does work on codewars.
    This kata troubles me.

  • Default User Avatar

    If you are typing greet(Paul) then, here, Paul is the name of a variable and, if you haven't defined a variable named Paul in your computer/notebook then you will get a NameError.

    If you write somewhere earlier in your notebook: Paul = "test 123" then your function will return "Hello, test 123..." and no longer get the NameError since now you have defined a variable named Paul.

    Whereas when you type greet("Paul") you are passing the string "Paul" as an argument, so the function executes as you would expect, using "Paul" wherever name appears in the function body.

  • Custom User Avatar

    why does the answer work on codewars but not on my computer (i'm using VSC with python 3.10.9 and jupyter Notebook) ?
    For example:
    greet(Paul)
    gives me an error:

    NameError Traceback (most recent call last)
    Cell In [10], line 1
    ----> 1 greet(Paul)

    NameError: name 'Paul' is not defined

    But: greet('Paul') works well