Difference between revisions of "EGR 103/Concept List/F22"
Jump to navigation
Jump to search
(Created page with "== Lecture 1 - 8/29 - Course Introduction == * Main class page: [http://classes.pratt.duke.edu/EGR103F22/ EGR 103L] ** Includes links to Sakai, Pundit, and Ed pages * Sakai pa...") |
|||
Line 4: | Line 4: | ||
* Sakai page: [https://sakai.duke.edu/portal/site/egr103f22 Sakai 103L page]; grades, surveys and tests, some assignment submissions; first day slideshow in Resources section | * Sakai page: [https://sakai.duke.edu/portal/site/egr103f22 Sakai 103L page]; grades, surveys and tests, some assignment submissions; first day slideshow in Resources section | ||
− | |||
== Lecture 2 - 8/27 - Programs and Programming == | == Lecture 2 - 8/27 - Programs and Programming == | ||
* Almost all languages have input, output, math, conditional execution (decisions), and repetition (loops) | * Almost all languages have input, output, math, conditional execution (decisions), and repetition (loops) | ||
− | * Seven steps of programming [https://adhilton.pratt.duke.edu/sites/adhilton.pratt.duke.edu/files/u37/iticse-7steps.pdf The Seven Steps Poster] | + | * Seven steps of programming [https://adhilton.pratt.duke.edu/sites/adhilton.pratt.duke.edu/files/u37/iticse-7steps.pdf The Seven Steps Poster]. Also, for Monday's class: |
** Watch video on [https://www.coursera.org/lecture/duke-programming-web/developing-an-algorithm-nopgq Developing an Algorithm] | ** Watch video on [https://www.coursera.org/lecture/duke-programming-web/developing-an-algorithm-nopgq Developing an Algorithm] | ||
** Watch video on [https://www.coursera.org/lecture/duke-programming-web/a-seven-step-approach-to-solving-programming-problems-AEy5M A Seven Step Approach to Solving Programming Problems] | ** Watch video on [https://www.coursera.org/lecture/duke-programming-web/a-seven-step-approach-to-solving-programming-problems-AEy5M A Seven Step Approach to Solving Programming Problems] | ||
− | * Consider how to decide if a number is a prime number | + | * Problem: Consider how to decide if a number is a prime number |
+ | ** Some "shortcuts" for specific factors but need to have a generalized approach | ||
+ | ** See if number is evenly divisible by any integer between 2 and the square root of the number - but how do we ask the computer to do that? | ||
+ | * Quick tour of Python | ||
+ | ** Console (with history tab), variable explorer (with other tabs), and editing window | ||
+ | ** Main numerical types: whole numbers (int) and numbers with decimals (float) | ||
+ | ** Can use % (called "mod") to get "remainder" | ||
+ | *** If both items are integers, result is an integer; if either is a float, result is a float | ||
+ | ** Relational operators: < <= == >= > != | ||
+ | *** Result is is either <code>True</code> or <code>False</code> | ||
+ | * Comments in code: | ||
+ | ** If there is a <code>#</code>, Python ignores everything remaining in that line after the # | ||
+ | ** If there are <code>"""</code> or <code>'''</code>, Python ignores everything until the closing <code>"""</code> or <code>'''</code> | ||
+ | ** If you use <code># %%</code> in Spyder, the editing window will set up a '''cell''' and light up the cell your cursor is in. Cells have no impact on how the code runs, just how the code appears in the window | ||
+ | <!-- | ||
* To play with Python: | * To play with Python: | ||
** Install it on your machine or a public machine: [https://www.anaconda.com/download/ Download] | ** Install it on your machine or a public machine: [https://www.anaconda.com/download/ Download] | ||
− | |||
− | |||
− | |||
** + - * // (rounded division) and % (remainder / modula) produce in if both sides are an int, float if either or both are floats | ** + - * // (rounded division) and % (remainder / modula) produce in if both sides are an int, float if either or both are floats | ||
** / (regular division) and // (rounded division) produces float with ints or floats | ** / (regular division) and // (rounded division) produces float with ints or floats | ||
Line 24: | Line 34: | ||
** <code>VAR = input("prompt: ")</code> will ask the user for a value and stores whatever they type as a string | ** <code>VAR = input("prompt: ")</code> will ask the user for a value and stores whatever they type as a string | ||
** <code>NUM = int(VAR)</code> will convert the item in VAR to an integer if it looks like an integer; error otherwise | ** <code>NUM = int(VAR)</code> will convert the item in VAR to an integer if it looks like an integer; error otherwise | ||
− | |||
== Lecture 3 - 8/30 - "Number" Types == | == Lecture 3 - 8/30 - "Number" Types == | ||
* Finished prime number checker - code is available in the Box drive for the class under Lectures / Lec03 | * Finished prime number checker - code is available in the Box drive for the class under Lectures / Lec03 |
Revision as of 16:50, 2 September 2022
Lecture 1 - 8/29 - Course Introduction
- Main class page: EGR 103L
- Includes links to Sakai, Pundit, and Ed pages
- Sakai page: Sakai 103L page; grades, surveys and tests, some assignment submissions; first day slideshow in Resources section
Lecture 2 - 8/27 - Programs and Programming
- Almost all languages have input, output, math, conditional execution (decisions), and repetition (loops)
- Seven steps of programming The Seven Steps Poster. Also, for Monday's class:
- Watch video on Developing an Algorithm
- Watch video on A Seven Step Approach to Solving Programming Problems
- Problem: Consider how to decide if a number is a prime number
- Some "shortcuts" for specific factors but need to have a generalized approach
- See if number is evenly divisible by any integer between 2 and the square root of the number - but how do we ask the computer to do that?
- Quick tour of Python
- Console (with history tab), variable explorer (with other tabs), and editing window
- Main numerical types: whole numbers (int) and numbers with decimals (float)
- Can use % (called "mod") to get "remainder"
- If both items are integers, result is an integer; if either is a float, result is a float
- Relational operators: < <= == >= > !=
- Result is is either
True
orFalse
- Result is is either
- Comments in code:
- If there is a
#
, Python ignores everything remaining in that line after the # - If there are
"""
or, Python ignores everything until the closing
"""
or - If you use
# %%
in Spyder, the editing window will set up a cell and light up the cell your cursor is in. Cells have no impact on how the code runs, just how the code appears in the window
- If there is a