Ask coding questions

← Back to all posts
I am a pretty new PY coder, and I was wondering how to fix this bug.
Wanyh29 (2)

The function ":" has an Invalid Syntax.

Answered by FishballNooodle (206) [earned 5 cycles]
View Answer
FishballNooodle (206)

The error shown in the picture is different from the error when I ran the repl.

The ERROR in the picture

You used the def keyword to define the function.
It should generally (based on PEP 8) should look something like this.

def function_name(first_name,last_name):
    print(f"Hello, {first_name} {last_name}")

You should also be using input to get user input
age = int(input("Enter in your age: "))

Do note that copying code outside of replit into replit may not work as replit works slightly different when it comes to Package/Modules/File Handling. This explains why there is another error when the repl is being run (Circular Import)

You may also want to try considering making your own program from scratch so you learn faster instead of trying to understand other people's code.