Difference between revisions of "EGR 103/Concept List/F23"
Jump to navigation
Jump to search
(→Lecture 2 - 9/1 - Introduction to Programming) |
(→Lecture 2 - 9/1 - Introduction to Programming) |
||
Line 10: | Line 10: | ||
== Lecture 2 - 9/1 - Introduction to Programming == | == Lecture 2 - 9/1 - Introduction to Programming == | ||
− | * 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] |
** 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] |
Revision as of 16:29, 1 September 2023
Lecture 1 - 8/28 - Course Introduction
- Main class page: EGR 103L
- Includes links to Canvas, Pundit, and Ed pages
- Sakai page: Canvas103L page; grades, surveys and tests, some assignment submissions; first day slideshow in Resources section goes over everything else.
- For next Friday's class:
- Log in at Coursera at Duke
- Watch video on Developing an Algorithm
- Watch video on A Seven Step Approach to Solving Programming Problems
- See Seven steps of programming The Seven Steps Poster.
Lecture 2 - 9/1 - Introduction to Programming
- Seven steps of programming The Seven Steps Poster
- Watch video on Developing an Algorithm
- Watch video on A Seven Step Approach to Solving Programming Problems
- Almost all languages have input, output, math, conditional execution (decisions), and repetition (loops)
- Problem: Consider how to decide if a number is a prime number
- Some "shortcuts" for specific factors (2, 3, and 5, for example) 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?
- We can use output to get the computer to ask for a number and we can use input to allow the computer to receive that number
We can use math and the mod operator (%) to see if one number is evenly divisible by another, a loop to go through all possible relevant divisors, and a decision structure to choose what to do if we determine that a number is not prime.
- Very quick tour of Python with Spyder
- Console (with history tab), info box (with variable explorer, files, and other tabs), and editing window
- Pushing "play" button or hitting F5 will save the script, change the working directory, and run the script
- Quick introduction to variable types: int, float, str
- Quick introduction to indexing: Python is "0" indexed, meaning if there is a collection of items called x, x[0] will be the "first" item in the collection and x[N-1] where N is the total number of items will be the last item. Also, reverse indexing, where x[-1] is the last item and x[-N] is the first item.