3.1 Built-in function
Type (All) = <class ' int ' >
Int (' + ') =>32
int (3.9) = 3
Int ( -2.3) =>-2
Float (+) = 32.0
Float (' 3.14159 ') =>3.14159
STR (+) = ' 32 '
STR (3.14159) = ' 3.14159 '
3.2 Define a function
Defining a function creates a function object, which has type function.
You can run it with to create a function before. In other words, the function definition had to run before the function gets called.
The rules for function names is the same as for variable names:letters, numbers and underscore is legal, but the first Character can ' t be a number.
Single quotes and double quotes do the same thing; Most people with single quotes except in cases like this where a single quote (which was also an apostrophe) appears in the String.
function definitions get executed just like other statements, but the effect is to create function objects. The statements inside the function does not run until the function is called, and the function definition generates no OUTPU T.
3.3 Flow of execution
Execution always begins at the first statement of the program. Statements is run one at a time and in the order from top to bottom.
function definitions does not alter the flow of execution in the program, but remember that statements inside the function D On ' t run until the function is called.
A function call was a detour in the flow of execution. Instead of going to the next state-ment, the flow jumps to the body of the function, runs the statements there, and then Comes back to pick up where it left off.
3.8 Variables and parameters are local
When you create a variable inside a function, it's local, which means that it's only exists inside the function.
Think Python Chapter3