CSE 1010 Lecture 9: Functions, User defined functions, Multiparameter functions, Named arguments, Default arguments

15 views2 pages
Verified Note

Document Summary

Functions are a way to group statements together and give them a name: after writing a function to solve a problem you can recall it in other programs so that you never have to re-solve that problem. Print, input, len, int, random. randint: you don"t need to know how they work, just what they do. Every language gives you the ability to create your own functions. Creating functions is an integral part of a well designed program. Format: name: any valid identi er, parameters: the unknowns used in the body, body: any group of statements. After a functions ends, all of its variables are cleared. If there is already a variable with the same name de ned before we call the function, it is overwritten, but once it is cleared and the variable reverts. Do not need to be in order, but the parameter names must be already de ned in the function.

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