Search code examples
pythonstringfunctionprintfuser-defined-functions

How can I Get My Custom Function to Execute Correctly?


enter image description here

I'm just following my teacher's example. She added that f in the body. I removed it but still got the same result. My name should appear when I run it, instead (name) appears.


Solution

  • You need to use the curly brackets { } instead of ( )

    def say_hello(name):
        print(f"Hello, {name}!")
    
    say_hello("Roxy")