OneCompiler

How Set a function using Python

367

How use the def() python's command

def NameOfYouFunc(): # can you edit the name of the func
  pass # remove the pass and this comment and write you python code
NameOfYouFunc() # this is for exec the code but can you import in another code like this exemple
def Func():
  print("I have a code on my account using func sets to print hello world")
if __name__ == "__main__":
  Func()
from Func import Func
Func()

for exec in another code you func

Em Portugues

Como Setar uma função em python

def NameOfYouFunc(): # Você pode editar o nome da função
  pass # remova o pass e este comentario e escreva o codigo da função
NameOfYouFunc() # Este comando é para executar mais você pode executar em outro arquivo python como no exemplo a seguir
def Func():
  print("Eu tenho um codigo que usa o def() para printar hello world")
if __name__ == "__main__":
  Func()
from Func import Func
Func()