Class Notes (835,798)
Canada (509,410)

Engineering 1D04 Notes.docx

3 Pages
Unlock Document

Engineering (General)
William Farmer

Engineering 1D04 Notes Chapter 2 – Writing Simple Programs 2.1 The Software Development Process  Steps to writing programs: o Analyze the problem – figure out the problem and what you are doing o Determine Specifications – describe what your program will do. o Create a Design – determine the how. Formulate the structure. o Implement a Design – translate the design into a computer. o Test / Debug the program – fix any errors by running the program. o Maintain the program – develop the program in response to the user’s needs.  Debugging – the process of locating and fixing errors. 2.3 Elements of Programs Names:  These are given to modules and the functions within modules.  They are known as identifiers.  Identifiers are case-sensitive.  Reserved Words – identifiers that are part of python itself. They are part of Python and cannot be used as identifiers. Expressions:  These are the fragments of code that produce or calculate new data values.  Literal – the simplest kind of expression.  They indicate a specific value.  Spaces are irrelevant within an expression.  Operators are +, -, *, etc… 2.4 Output Statements  There are rules for syntax (form) and semantics (meaning).  Meta-languages are sophisticated notations that describe programming languages.  An expression that doesn’t produce a number but rather a sequence of character data is called a string. 2.5 Assignment Statements  =  The variable is the identifier. The variable can be assigned multiple times. Assigning Input:  Input statements get information from the user and store it into a variable.  Input is accomplished by using an assignment statement combined with a special expression called input.  = input()  Prompt is usually a string literal. (text inside quotations).  The input is like a delayed expression. Simultaneous Assignment:  , = ,  This calculates several variables at a time.  A way of swapping work is to introduce a temporary variable. Or just do simultaneous assignment. 2.6 Definite Loops  Programmers use loops to execute a sequence of statements several times in successions. The simplest kind is the definite loop.  Counted loop: given a range to iterate the program  For loop: for in : o  Loop index: is the variable after the keyword for.  Sequence: consists of a
More Less

Related notes for ENGINEER 1D04

Log In


Join OneClass

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

Sign up

Join to view


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.