definition
Jump to navigation
Jump to search
definition is a Python subset where you have to define a function to even run the program (variables, lists and dictionaries don't count, runing the first defined function is done automaticly)
Syntax
You have to define a function and put your code into that function:
def main(): x=0; print(x)
Variables can be outside functions. But that makes the variable global
To disable it from entering a function, you just do this:
x=0 def main(): print(x) def main2(): dont(x) print("x cannot enter this function") run(main,main2)
And to make a local variable and add it to a function, do this:
def main(): x=0; print(x) def main2(): do(x) print(f"{x=}","value taken from the main function") run(main,main2)
run
is self-explanatory. It just runs functions on a list
Examples
Hello, world!
def m(): print("Hello, world!")