CoderPerson
CoderPerson

Reputation: 100

How can I change def to something else?

I always type in function something():. Is their any way to change def to function? I know this sounds like a silly question, but I would really appreciate any answers.

If their is something like that, can you also change print or input? For example:

name = question("What is your name? ")
answer(f"Hi {name}!")

Upvotes: 4

Views: 352

Answers (1)

catasaurus
catasaurus

Reputation: 966

This works for print and input:

question = input
answer = print

You can call them like this:

question("What is your name? ")
answer(f"Hi {name}!")

As for changing def you probably would have to modify the source code of your python installation and recompile it to do something like that. That would be a very bad practice as it would then make it your python installation incompatible with almost 100% of python code that can be downloaded and run.

Take a look at this for more info on changing def to function

Upvotes: 2

Related Questions