Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Introduction to Programming using Python

This 90-minute talk+demo is targeted towards 10-18 year olds to teach programming fundamentals, targeted more for those growing beyond the concepts they've already learned using other tools such as Alice & Scratch but also friendly to absolute beginners.

wesley chun

on 25 May 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Introduction to Programming using Python

Introduction to Programming 2: Python +Wesley Chun
Developer Relations
Google, Inc.
@wescpy Directions to get somewhere Let's not talk about programming just yet...
How about a more common problem? You know, following directions... So what is programming then? Computers are "stupid" They need directions or are useless Why do people get mad at computers? Lack of communication Humans just don't "speak" computers Programming is how you "talk" to computers Granted some programmers are so good
at talking to computers that they don't
relate as well to real people... NERDS!!! The Good and the Bad There are good directions There are bad directions Good luck Users vs. Programmers Using computers Eating food Cooking food Programming
computers Programmers vs. Engineers Computer
programmer Software
engineer Cook Chef Why Programming? More control/power than being just a user
Scratch your own itch
Automate repetitive/boring tasks
Want to build things
Desire to become an artist You already program!! Cell phone
Alarm clock
Oven/Microwave What skills do I need? Curiosity, want to tinker
Problem solver
Decent at logic & math What are programming languages? Various dialects that let humans give instructions to computers Some are easier than others
Some are special-purpose
Adults: Java, C/C++, Python, Ruby, PHP
Kids: Scratch, Alice, Python, BASIC Getting Started Starting Python with IDLE
What is a GUI?
What is a shell?
What is an IDE?
What is ">>>"?
What is a prompt?
What is a command/statement?
What is "interactive mode?" Live experience print can do text (strings of characters)
print can do math
Arithmetic operators: + - * / % //
Some work for strings: + * %
Basically, computers are expensive calculators
Saving and running your programs
Look at output as you're working
Exiting IDLE Making mistakes unless... more experimenting... Computer Variables Almost the same as algebra
Memory that represents some value (object)
Value can be a number, text, and much more
Except for special ones, should be lowercase
You're saving values you need to use later
Can't use reserved words or keywords though
Live experience Algebra Review Variables: letters representing a non-constant value
X = 1
What is X + 4?
How about Y if Y = X - 3? What is Python 3? The book and our class uses Python 2
Most of the world still uses Python 2
Python 3 is the next generation
It's already arrived for people to play with
Language cleanup and evolution
print is changing to print() [a "function"]
Functions may take input and produces a result
We have already used functions... raw_input()
BTW, raw_input() is changing to input() Yes & No == True & False Life is simple for computers
"Boolean": true and false for yes and no
1 means yes or Boolean true (True)
0 means no or Boolean false (False)
(Actually, 0 is false and everything else is true.) Conditional Operators > >= < <= == != Odd and Even Numbers How do you tell them apart? Really!
A computer does it the same way. Really!
(But you have to tell it to do it that way.) :-)
Live experience featuring modulo ( % ) Conditional Statements if
if-elif-else Most programming languages have an if construct
Live experience
Try it with odd and even numbers!
How about chaining multiple conditionals? Where computers differ from algebra Happens when you need to reuse a variable, e.g.,
X = X + 1 makes no sense in algebra; the equivalent
X == X + 1 will always be Boolean false
X = X + 1 means something else:
Take the value X+1 and reassign it back to X
Always do everything on the right-hand side first
Live experience in Python Counting (as a Human) How do you count from 1 to 5?
Think carefully... how do you really do it?
How do you think a computer does it?
X = 1
X = 2
X = 3
X = 4
X = 5
No, that's just you doing it, not the computer Counting (as a Computer) Live experience:
take 1: nothing new here
take 2: using variable reassignment
take 3: introducing loops
final take: programming loops What's wrong here? The Computer/Software "Bug" Coined in 1878 by Thomas Edison
Popularized by Grace Hopper in 1947
One of many famous women programmers
She was probably first to use the term "debugging" Fixing the bug Flow Diagram of Odd/Even Live experience Loops Repeat a block of code over and over
(do-while) Advanced Live experience: Catching your mistakes
Live experience: More on Functions The End? Do you know enough now? (No.)
Did you learn something? (Yes?)
Congratulations for making it this far!
You've taken your next steps... more to come
Full transcript