Intro to CS Oct 18-19, 2015.

Slides:



Advertisements
Similar presentations
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 8 Fruitful Functions 05/02/09 Python Mini-Course: Day 2 - Lesson 8 1.
Advertisements

String and Lists Dr. Benito Mendoza. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list List.
 Recap – Python Basics. Python  Python is an interpreter which reads and executes a python script.  A python script is a text file, which contains.
Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
14/11/11.  These words have special meanings in themselves  These should NOT be used as Identifiers.  For example:  Break, do, function, case, else,
The If/Else Statement, Boolean Flags, and Menus Page 180
Python Control of Flow.
CSC 1701B Computing: Science and Creativity. Outline  Types  Variables  Operators  Control: sequence, selection, repetition  Functions (block headings.
SPELLING GAME PROJECT SAMPLE ASSESSMENT MATERIAL GCSE Computing.
Python Control Flow statements There are three control flow statements in Python - if, for and while.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
If statements while loop for loop
Collecting Things Together - Lists 1. We’ve seen that Python can store things in memory and retrieve, using names. Sometime we want to store a bunch of.
Praat LING115 November 4, Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from.
CS140: Intro to CS An Overview of Programming in C by Erin Chambers.
February ,  2/16: Exam 1 Makeup Papers Available  2/20: Exam 2 Review Sheet Available in Lecture  2/27: Lab 2 due by 11:59:59pm  3/2:
Iteration. Iteration: Review  If you wanted to display all the numbers from 1 to 1000, you wouldn’t want to do this, would you? Start display 1 display.
IS2802 Introduction to Multimedia Applications for Business Lecture 4: JavaScript, Loops, and Conditional Statements Rob Gleasure
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Programming Languages Programming languages are a compromise between spoken language and formal math. They allow humans to communicate with computers at.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
PH2150 Scientific Computing Skills Control Structures in Python In general, statements are executed sequentially, top to bottom. There are many instances.
Chapter 5: Loops Tarik Booker CS 201 California State University, Los Angeles.
Python Basics.
PHP using MySQL Database for Web Development (part II)
String and Lists Dr. José M. Reyes Álamo.
Introduction to Scratch
Topic 02: Introduction to ActionScript 3.0
August 31 Intro to CS.
Topic: Iterative Statements – Part 1 -> for loop
Introduction to Python
CMSC201 Computer Science I for Majors Lecture 22 – Binary (and More)
Intro to CS Sept 22/23, 2015.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
ECS 9/7/17.
CSC 108H: Introduction to Computer Programming
Intro to CS Nov 13, 2017.
Week 3: Loops and strings
Strings Part 1 Taken from notes by Dr. Neil Moore
Series of Paragraphs Expressing an Opinion
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
Decision Structures, String Comparison, Nested Structures
Selection CIS 40 – Introduction to Programming in Python
File Handling Programming Guides.
In Class Program: Today in History
Types, Truth, and Expressions (Part 2)
6. Lists Let's Learn Python and Pygame
Types, Truth, and Expressions (Part 2)
Types, Truth, and Expressions (Part 2)
PHP.
Loops CIS 40 – Introduction to Programming in Python
Coding Concepts (Basics)
String and Lists Dr. José M. Reyes Álamo.
Introduction to Problem Solving and Control Statements
Logical Operations In Matlab.
Python programming exercise
Using Lists and Functions to Create Dialogue
February , 2009 CSE 113 B.
Tutorial 10: Programming with javascript
Selection Statements Chapter 3.
Types, Truth, and Expressions
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
Topic: Iterative Statements – Part 2 -> for loop
Class code for pythonroom.com cchsp2cs
Web Programming and Design
Strings Taken from notes by Dr. Neil Moore & Dr. Debby Keen
Intro to Programming (in JavaScript)
Types, Truth, and Expressions (Part 2)
Presentation transcript:

Intro to CS Oct 18-19, 2015

Today’s Objectives Variables Strings String slice

Stock Trading 2010 Flash Crash: On May 6, 2010 Dow Jones stock exchange crashed ~1000 points within 36 minutes and recovered very fast.A large investor using an automated trading software to sell futures contracts sparked the brief-but-historic stock market "flash crash", according to a report by federal regulators. Citadel grp https://www.youtube.com/watch?v=2u007Msq1qo http://money.cnn.com/video/news/2013/07/05/n-cmr-citadel-trading-high-frequency.cnnmoney 60 minutes documentary https://www.youtube.com/watch?v=WstJM_aNSj8

Boolean - True or False Python SNAP TIMING 4 MINUTES (39 TOTAL) ACTUAL – ran out of time Now let’s take what we’ve learned and apply it to making a song Here’s an example with the start of Mary had A Little Lamb How can you execute a single program element? (double click) Individual notes can be played by double clicking on them. How can you execute a set of elements? You can tell what will execute together by them sticking together What white bar to know where you are inserting pull the bottom off to differentiate from ‘move’ You can predict what will fit where by shape. How do you delete an element? How do you reorder elements Notice the “Stop Script” block at the end. It’s always good programming practice to always have a “stop script” block and the end of any script so that you clearly indicate it’s the end. In BYOB, you don’t necessarily need to have it there, but if you learn other language it will be very important to always make sure you clearly indicate the end of scripts 7

Conditional - if, else SNAP PYTHON 5

For loop Print numbers between 0 & 5 for i in range(0,5): print (i) print letters in a word fruit = ‘banana’ length = len(fruit) for i in range(0,length): print (fruit[i]) 6

Exercise 1: Count number of words Open a new File in Sublime Text2 In Browser, Open URL https://en.wikipedia.org/wiki/Python_(programming_language) Copy the first paragraph in the article as variable ‘article’ find the length of ‘article’ and store in variable ‘length’ create a variable ‘wordcount’ which is counter for number of words use for loop to go through each letter in ‘article’ use if statement to check if the letter is space i.e. ‘ ‘ if letter is space, add 1 to ‘wordcount’ after completion of for loop, print the value of variable ‘wordcount' 7