Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to CS Oct 18-19, 2015.

Similar presentations


Presentation on theme: "Intro to CS Oct 18-19, 2015."— Presentation transcript:

1 Intro to CS Oct 18-19, 2015

2 Today’s Objectives Variables Strings String slice

3 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 60 minutes documentary

4 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

5 Conditional - if, else SNAP PYTHON 5

6 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

7 Exercise 1: Count number of words
Open a new File in Sublime Text2 In Browser, Open URL 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


Download ppt "Intro to CS Oct 18-19, 2015."

Similar presentations


Ads by Google