Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Nice using of f string
This is best practices now, ignore comments on second solution with format as they are 5 years old.
There was a time where format was best practices, because many apps still didn't move to a higher python version. But Python 3.6 (first version where f strings released) is no longer supported both development and security wise.
f strings are quite the beauty.
Any other solution besides this is simply over-engineering.
this translation seems busted. it's not published, but I can edit it (i wasnt aware that you could edit other people's translations ...). However, when hitting
publish
, it always fails withKumite was published with failed tests!
, even though the tests do not fail. Another Codewars mystery !This comment is hidden because it contains spoiler information about the solution
nice
thank you so much
This comment is hidden because it contains spoiler information about the solution
how are f strings useful?
just asking
has been forked and approved
This comment is hidden because it contains spoiler information about the solution
Thank you benjaminzwhite,
i'm wondering why
greet(Paul)
does work on codewars.This kata troubles me.
If you are typing
greet(Paul)
then, here,Paul
is the name of a variable and, if you haven't defined a variable namedPaul
in your computer/notebook then you will get aNameError
.If you write somewhere earlier in your notebook:
Paul = "test 123"
then your function will return"Hello, test 123..."
and no longer get theNameError
since now you have defined a variable namedPaul
.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"
wherevername
appears in the function body.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
Loading more items...