Unit 2 & 3.docx

1 Page
123 Views
Unlock Document

Department
Computing Science
Course
CMPT 120
Professor
Diana Cukierman
Semester
Fall

Description
Unit 2 Value – a letter or number  Integer – whole numbers  String – a “string” of letters enclosed in quotation marks Floating-point – numbers with a decimal point Operators – special symbols that represent computations (+, -) Expression – combination of values, variable and operators Statement – a unit of code that Python can execute. (Print & Assignment)  Expression has a value; statement does not. PEMDAS – Order of operations within Python  Parentheses 2 * (3-1) = 4  Exponentiation 3*1**3 = 3, not 27  Multiplication 2*3-1 = 5, not 4  Division 6+4/2 = 8, not 5  Addition 5-1+2 = 2, not 6  Subtraction 4-3 = 1 Concatenation – joining strings by linking them end to end  Example: first = “throat” second = “warbler” >>> print first + second throatwarbler Unit 3 Function – name of a sequence of statements that performs a computation Function call – when you “call” the function by name  Example: >>> type (32)  Argument – a value provided to a function  Return value – the result of an argument int – takes any value and
More Less

Related notes for CMPT 120

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit