Coding 4-5 B

MP4 Week 5

Let get flowing!

  1. Installing Python
  2. Getting started with flowcharts
  3. Comparing Scratch, flowcharts symbols, and Python

Getting started with Python

IT has installed Python on all PALCS computers!
  1. Go to your software catalog (you may need to restart your computer first)
  2. Go to PALCS
  3. Go to Python 3.4.4
  4. Click install
  5. 2 Desktop icons will appear on your desktop: Idle & Python
  6. Click on Idle
  7. A Python shell window opens! You can now start coding! Just type into the window after the the angle brackets (>>>).
  8. We'll be coding a program together in Python in chat and running it in Scratch!
Big image

Try it! Make Your Computer Say "Hello World!"

  1. Open IDLE (the shell window opens)
  2. Click the "file" menu and choose "new file" (this opens the code window)
  3. In the new blank code window type: print ('Hello World!')
  4. Make sure you used single quotation marks!
  5. Save the code: click "file", "save as", name it HelloWorld, and "save."
  6. Click the "run" menu and select "run module." (this will run the program in the shell window)
  7. Output: look in the shell window. The "Hello World" message should appear when the program runs! You've just created your first bit of code in Python!
*Remember: a code that is not saved won't run!

*If a pop-up window appears with a SyntaxError message it often means there is a spelling mistake or typing error in the code.

Last Week

Flowchart Symbols Used in Programming

What Scratch Blocks Do They Represent?

Big image

Send me your Maze Program!

  • Send me the URL to your Maze Program in Moodle!
  • Make sure your share it so I can view it!

Next Week Goals:

  1. More with text
  2. Python and math
  3. Learn about while loops

Strings

  • Line of code

print ("Question: What goes clip?\nAnswer: A one legged horse.")

Escape Sequences

  • A sequence of characters that starts with a backslash


\n : new line of text

\t: creates a tab style indent

\\: allows a backslash to appear in a string of text

\": allows a speech mark to be used in a string of text

Try it

print ("Here is a speech mark: \" and here is a slash: \\")


print ('I say "High", you say "Low". You say "Why?" and I say "I don\'t know". Oh no.')

See you in Cyberspace!