ECS 10 Lecture Notes - Lecture 4: Local Variable, Global Variable

54 views2 pages

Document Summary

You can create a function using the alphanumeric rules as it follows: def functionname (parm1name, parm2name) This will define the code that will run when it is called, and it needs to be indented to belong to the function. the indent is part of the syntax. Functions does not activate unless they are called by the user. The scope of a variable is the area that the variable exists in, so the functions will reference only their variables, and if you try to reference them outside the area, then they will return an error. Functions will pass a copy through the code, not the actual object inside the variable. Parameters are the arguments found inside the function creation. A return value will return what the function outputs. returns can return nothing at all. By default the function will return none.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents