Difference between revisions of "EGR 103/Concept List Fall 2019"
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
* Quick tour of Python | * Quick tour of Python | ||
** Editing window, variable explorer, and console | ** Editing window, variable explorer, and console | ||
− | * | + | * You are not expected to remember any of the specifics about how Python stores things or works with them yet! |
+ | |||
+ | == Lecture 3 - "Number" Types == | ||
+ | * Python is a "typed" language - variables have types | ||
+ | * We will use eight types: | ||
+ | ** Focus of the day: int, float, and array | ||
+ | ** Focus a little later: string, list, tuple | ||
+ | ** Focus later: dictionary, set | ||
+ | * int: integers; Python can store these perfectly | ||
+ | * float: floating point numbers - "numbers with decimal points" - Python sometimes has problems | ||
+ | * array | ||
+ | ** Requires numpy, usually with <code>import numpy as np</code> | ||
+ | ** Organizational unit for storing rectangular arrays of numbers | ||
+ | * Math with "Number" types works the way you expect | ||
+ | ** ** * / // % + - | ||
+ | * Relational operators can compare "Number" Types and work the way you expect with True or False as an answer | ||
+ | ** < <= == >= > != | ||
+ | ** With arrays, either same size or one is a single value; result will be an array of True and False the same size as the array | ||
+ | * Slices allow us to extract information from an array or put information into an array | ||
+ | * a[0] is the element in a at the start | ||
+ | * a[3] is the element in a three away from the start | ||
+ | * a[:] is all the elements in a because what is really happening is: | ||
+ | ** a[start:until] where start is the first index and until is just *past* the last index; | ||
+ | ** a[3:7] will return a[3] through a[6] in 4-element array | ||
+ | ** a[start:until:increment] will skip indices by increment instead of 1 | ||
+ | ** To go backwards, a[start:until:-increment] will start at an index and then go backwards until getting at or just past until. | ||
+ | * For 2-D arrays, you can index items with either separate row and column indices or indices separated by commas: | ||
+ | ** a[2][3] is the same as a[2, 3] | ||
+ | ** Only works for arrays! | ||
<!-- | <!-- |
Revision as of 21:00, 2 September 2019
This page will be used to keep track of the commands and major concepts for each lecture in EGR 103.
Lecture 1 - Introduction
- Class web page: EGR 103L; assignments, contact info, readings, etc - see slides on Errata/Notes page
- Sakai page: Sakai 103L page; grades, surveys and tests, some assignment submissions
- CampusWire page: CampusWire 103L page; message board for questions - you need to be in the class and have the access code to subscribe.
Lecture 2 - Programs and Programming
- Seven steps of programming -
- Watch video on Developing an Algorithm
- Watch video on A Seven Step Approach to Solving Programming Problems
- To play with Python:
- Install it on your machine or a public machine: Download
- Quick tour of Python
- Editing window, variable explorer, and console
- You are not expected to remember any of the specifics about how Python stores things or works with them yet!
Lecture 3 - "Number" Types
- Python is a "typed" language - variables have types
- We will use eight types:
- Focus of the day: int, float, and array
- Focus a little later: string, list, tuple
- Focus later: dictionary, set
- int: integers; Python can store these perfectly
- float: floating point numbers - "numbers with decimal points" - Python sometimes has problems
- array
- Requires numpy, usually with
import numpy as np
- Organizational unit for storing rectangular arrays of numbers
- Requires numpy, usually with
- Math with "Number" types works the way you expect
- ** * / // % + -
- Relational operators can compare "Number" Types and work the way you expect with True or False as an answer
- < <= == >= > !=
- With arrays, either same size or one is a single value; result will be an array of True and False the same size as the array
- Slices allow us to extract information from an array or put information into an array
- a[0] is the element in a at the start
- a[3] is the element in a three away from the start
- a[:] is all the elements in a because what is really happening is:
- a[start:until] where start is the first index and until is just *past* the last index;
- a[3:7] will return a[3] through a[6] in 4-element array
- a[start:until:increment] will skip indices by increment instead of 1
- To go backwards, a[start:until:-increment] will start at an index and then go backwards until getting at or just past until.
- For 2-D arrays, you can index items with either separate row and column indices or indices separated by commas:
- a[2][3] is the same as a[2, 3]
- Only works for arrays!