CompSci 101 Introduction to Computer Science

Slides:



Advertisements
Similar presentations
CompSci 101 Introduction to Computer Science January 22, 2015 Prof. Rodger compsci101 spring151.
Advertisements

CompSci 101 Introduction to Computer Science February 3, 2015 Prof. Rodger Lecture given by Elizabeth Dowd.
CompSci 101 Introduction to Computer Science Feb 26, 2015 Prof. Rodger.
CompSci 101 Introduction to Computer Science January 13, 2015 Prof. Rodger compsci 101 spring
HOMEWORK REVIEW This is an if else statement layout if (condition) { code to be executed if condition is true; } else { code to be executed if condition.
Compsci 06/101, Fall What will we do today? l Practice solving problems  Solving problems without a computer  Is this different than solving.
CompSci 101 Introduction to Computer Science September 23, 2014 Prof. Rodger.
CompSci 101 Introduction to Computer Science Sept. 9, 2014 Prof. Rodger President Brodhead speech graduation 2010 CompSci 101 Fall
Compsci 6/101, Spring More on Python, Tools, Compsci 101 l APTs, Assignments, Tools  APT: Algorithmic Problem-solving and Testing  How to get.
Compsci 06/101, Fall Vocabulary l What's the Spanish word for 'boy'? 'eat'?  How do you know? l What about the Turkish equivalents?  How do.
CompSci 6 Introduction to Computer Science September 13, 2011 Prof. Rodger.
Compsci 101, Fall Plan For The Day (PFTD) l Practice solving problems  Some solved with a computer, some with Python  Differences in solving.
CompSci 101 Introduction to Computer Science January 28, 2016 Prof. Rodger compsci101 spring161.
CompSci 101 Introduction to Computer Science February 4, 2016 Prof. Rodger compsci101 spring161.
CompSci 6 Introduction to Computer Science Sept. 20, 2011 Prof. Rodger CompSci 6 Fall
CompSci 101 Introduction to Computer Science January 26, 2016 Prof. Rodger compsci 101, spring
CompSci 101 Introduction to Computer Science January 15, 2015 Prof. Rodger 1.
CompSci 6 Introduction to Computer Science September 27, 2011 Prof. Rodger CompSci 6 Fall
CompSci 101 Introduction to Computer Science February 5, 2015 Prof. Rodger Lecture given by Elizabeth Dowd compsci101 spring151.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Prof. Jeremy.
CompSci 101 Introduction to Computer Science Sept 13, 2016 Prof. Rodger compsci101 fall161.
CompSci 4 Java 1 Apr 2, 2009 Prof. Susan Rodger. Announcements Assignment 7 questions? –Beware having two events that kick in at the same time! –Beware.
CompSci 101 Introduction to Computer Science
Topic: Functions – Part 1
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Algorithmic complexity: Speed of algorithms
Topic: Conditional Statements – Part 1
CompSci 6 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
What to do when a test fails
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Testing and Debugging.
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Learning to Program in Python
Cracking the Coding Interview
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
CompSci 101 Introduction to Computer Science
Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Algorithmic complexity: Speed of algorithms
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Sight Words.
CMSC201 Computer Science I for Majors Final Exam Information
Algorithmic complexity: Speed of algorithms
the you are to was they of that as in for I and it with is on my a he
Introduction to Programming
Lecture 20 – Practice Exercises 4
Lecture 20 – Practice Exercises 4
CompSci 101 Introduction to Computer Science
Presentation transcript:

CompSci 101 Introduction to Computer Science Sep 14, 2017 Prof. Rodger compsci101 fall17

Announcements Reading and RQ6 due next time Assignment 2 due today, Assignment 3 out APT 2 due on Tuesday Today: Problem solving: Strings, Lists Looping over structures (characters, words) and building something Middle of September – Sept 15 compsci101 fall17

Review Functions www.bit.ly/101f17-0912-3 compsci 101, fall 2017 Show this in Python Tutor! compsci 101, fall 2017

Review Functions www.bit.ly/101f17-0912-3 Output 1. GoGoGo 2. GoGoGoGoGo None 3. None 5. GoGoGoGo Show this in Python Tutor! compsci 101, fall 2017

How many ways can I run Python in this course? Eclipse Complete program Interactive Console APT Online textbook We are using Python 2.7 ‘/’ (2.7) vs ‘//’ (3) Python Tutor What is an APT, testing one method and it comes with free tests. YOU WILL KNOW when an APT is correct! You may not know for an assignment. Have not seen python tutor yet, will see today compsci 101, fall 2017

Use Python Tutor Debug/trace your code Doesn’t work with input files Trace through previous example with Python Tutor compsci 101, fall 2017

More on Strings w o r d Strings are indexed starting at 0 Example: ‘word’ Use [x] – to refer to a particular character in word Use [x:y] to refer to a slice of the string starting at position x and up to but not including position y. Can leave out x or y. w o r d 0 1 2 3 compsci101 fall17

Examples bit.ly/101f17-0914-1 phrase = "Duke Blue Devils" 1) phrase[0] + phrase[-3] + phrase[-2]*2 2) phrase[5:10] + phrase[:4] 3)(phrase[phrase.find('ev'):]).upper() 4) phrase[-5::2] + phrase[:4:-1] antigravity String fun Crazy import compsci101 fall17

Loop over all characters in a String Show in Python tutor Ask what the purpose of answer is compsci101 fall17

Loop over string www.bit.ly/101f17-0914-2 compsci101 fall17

Loop over all words in a list compsci101 fall17

Loop over words www.bit.ly/101f17-0914-3 compsci101 fall17

Computer Science Alum Biology and CS Undergraduate Research - JFLAP Epic Now in Med School at Vanderbilt STARTED THE MAJOR LATE! Julian Genkins – he came to Duke premed. His fourth semester he took a computer science course and fell in loved it. He decided then to double major in CS and Biology. He did research with me on creating educational software. Then he took a gap year and worked at Epic for a year while he applied for med schools, and got a full scholarship to Vanderbilt. With me just being in the hospital. It is pretty neat that Julian contributed to the EPIC medical software that Duke uses to manage my care while I am in the hospital. He just wrote me sept 2014 and said he is on a student technology committee, focused on using technology in medical education. He is implementing new tools. “I cannot tell you how many times my experiences working on JFLAP have come in handy” compsci101 fall17

Assignment 3 snarf to use starter files Turtles Creative Earthquakes Data from last 30 days around the world Example - Find the largest earthquake compsci101 fall17

Getting Started with Earthquake part Read lines of data into a list of strings compsci101 fall17

Getting Started with Earthquake part Read lines of data into a list of strings You must modify to put in correct format! Create Empty list source is a file Iterate over lines in file Remove carriage return from line Add line from file to the list Return list of strings compsci101 fall17

Getting Started with Earthquake part Here is first few lines of the small file: Read into a list, reformatting the lines Write function getParts to get parts of a line compsci101 fall17

Use the list to calculate facts about earthquakes Two parameters – number and list of strings Returns a LIST of strings that meet criteria Use PrintQuakes with the list to print We ask you to write some specific functions and you can write other functions compsci101 fall17

Use the list to calculate facts about earthquakes Two parameters – number and list of strings Returns a LIST of strings that meet criteria Use PrintQuakes with the list to print compsci101 fall17

compsci101 fall17

compsci101 fall17

Answer Questions here: bit.ly/101f17-0914-4 LastNameFirst APT http://www.cs.duke.edu/csed/pythonapt/lastnamefirst.html Answer Questions here: bit.ly/101f17-0914-4 Come back to this a bit later. compsci101 fall17

Problem Solving to Code 7 Step Process Work small examples by hand Write down what you did in words (algorithm) Find Patterns (generalize algorithm) Work another example by hand (does your algorithm work? If not, go back to 2) Translate to code Test several cases Debug failed test cases Now you have several APTs to solve. It is a huge step to go from problem statement to code! Use the seven step process Which step is writing code? It is not step one!!!!!! compsci101 fall17

Use 7 step process to solve LastName First compsci101 fall17

Unused slides compsci101 fall17

More Computer Science Duke Alums Becky DeNardis (UTA and worked at Google two summers, then got a full time job at google, valedictorian, unfortunately, she was killed by a drunk driver, some of you may have heard about her. She was incredibly passionate about computer science and passionate about helping people learn computer science). , Deborah Nelson (rightmost triplet) took CompSci 101 – she taught English in Turkey for a year, then went to graduate school in Human Computer Interaction, now is a User Experience Designer for Blackbaud compsci101 fall17

Apply now for a scholarship to go to GHC 2017 15000 women in 2016!! Incredible conference for women in computing. Women are a minority in computing but not here! You won’t believe all these passionate women in computing compsci101 fall17