knowt logo

computer science notes


10 Functions Learned & Examples


  • *

# 1 - Input Function:

- An Input Function Includes 3 Variables: Name, Object (sprite, characters, etc.), and Place (setting)

- An input function can change the values for the variables and it can create a vaguely distinct story every time.


#2 - Variables:

- Variables are data items that may take on more than one value during the runtime of a program.

- Variables can be reused various times across a program.

- A person's Name, place, and Object are variables that are used various times in the program.


#3 - Conditionals & Using If Statements:

- If statements let the computer make selections automatically and modify the output be conditional on precise conditions.

- An If statement can be used to ask questions, and respond as if the program actually is a human.

- EXAMPLE:


Function Notes:

- When introducing through code (relevant to python), you often start with:

- “Print” or “S1” -> introducing strings, Or introduce it by defining it.

- This is because if you start with a code without adding an intro statement before that, the code has errors.

- Errors may take form because the code was not introduced with a definition. If the function is not defined, then there is no value to it, which gives it no place in the code.

FA

computer science notes


10 Functions Learned & Examples


  • *

# 1 - Input Function:

- An Input Function Includes 3 Variables: Name, Object (sprite, characters, etc.), and Place (setting)

- An input function can change the values for the variables and it can create a vaguely distinct story every time.


#2 - Variables:

- Variables are data items that may take on more than one value during the runtime of a program.

- Variables can be reused various times across a program.

- A person's Name, place, and Object are variables that are used various times in the program.


#3 - Conditionals & Using If Statements:

- If statements let the computer make selections automatically and modify the output be conditional on precise conditions.

- An If statement can be used to ask questions, and respond as if the program actually is a human.

- EXAMPLE:


Function Notes:

- When introducing through code (relevant to python), you often start with:

- “Print” or “S1” -> introducing strings, Or introduce it by defining it.

- This is because if you start with a code without adding an intro statement before that, the code has errors.

- Errors may take form because the code was not introduced with a definition. If the function is not defined, then there is no value to it, which gives it no place in the code.