student objective how are variables set up and used in programming n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Student objective: How are variables set up and used in programming? PowerPoint Presentation
Download Presentation
Student objective: How are variables set up and used in programming?

Loading in 2 Seconds...

play fullscreen
1 / 17

Student objective: How are variables set up and used in programming? - PowerPoint PPT Presentation


  • 89 Views
  • Uploaded on

Student objective: How are variables set up and used in programming?. Bell ringer: Where we using python in the interactive mode or script mode on Friday?. Set Up Grade Sheet. KWL (5) Syllabus (5) Communication compact (5 ) Computer Parts Project (25) Vocab (10) Print Project ( 10 )

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Student objective: How are variables set up and used in programming?' - miyo


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
student objective how are variables set up and used in programming

Student objective: How are variables set up and used in programming?

Bell ringer: Where we using python in the interactive mode or script mode on Friday?

set up grade sheet
Set Up Grade Sheet
  • KWL (5)
  • Syllabus (5)
  • Communication compact (5)
  • Computer Parts Project (25)
  • Vocab (10)
  • Print Project (10)
  • Number Guessing Game (10)
agenda
Agenda
  • Notes on python basics and variables
  • Assignments: programming
bell ringer answer interactive
Bell Ringer Answer: Interactive

Interactive mode-program and run in IDLE

  • Immediate feedback
  • Not designed to save and run later

Script Mode Write the program

  • Write program and save it to use later
let s try it
Let’s try it
  • To write a python program and save it:
  • Open Python IDLE
  • Click on file—New Window
  • Type your program in
  • File—Save as .pyin documents folder of python
  • Click Run—Run Module
  • IDLE pops back up with program
syntax errors
Syntax Errors
  • Spelling/grammar
  • Picked up prior to running program
runtime errors
Runtime errors
  • Occur during execution of program
  • 4-line error message starting with Traceback
  • Tells where the error is and what it is
semantic errors
Semantic errors
  • Don’t use commas with numbers or will get this error
  • Code will run but be wrong
computer
Computer
  • Input
  • Processing
  • Output
variables
Variables

Variables (values)

  • Integers: int numbers no decimal points
  • Strings: str use singleor double quotation character or string of characters: letters, numbers, punctuation
  • Long string: str multi-line string: triple quotes
  • Floating point: float decimal numbers
color coding
Color coding
  • Special words, like print: orange
  • Strings: green
  • Output: blue
  • Comments: red
comments
Comments
  • Used to explain code
  • Invaluable to programmers
  • Are not executable by the computer
  • # symbol is used to denote the start of a comment
blank lines and spacing
Blank Lines and Spacing

Blank lines

  • Are ignored by the computer
  • Can make program easier to read

Spacing

  • is critical and will create errors if not followed
  • Tells where blocks of code start and where they stop
  • Convention: 4 spaces in
  • Necessary for if statement
naming variables
Naming Variables
  • If you don’t know the type of variable, you can find out by
  • Writing in the IDLE:
  • type ( variable ) then click return (Remember strings in quotes, numbers not)
  • You can name variables (words, numbers) to input into memory (Name it so you can use it)
  • Teacher = “Mr. Morton”
  • First = 5
  • *You can have more than one name for one thing
  • *You can also change names
rules for naming variables
Rules for naming variables:
  • Can use letters, numbers and underscore character(_)
  • Case sensitive
  • Must start with letter or underscore (Not a good idea to start with underscore), NOT A NUMBER
  • Make variables names clear—don’t try to abbreviate
concatenate
Concatenate:
  • Adding strings like “cat” + “dog”
  • Results would be catdog
using variables
Using variables
  • Variables can also be made to equal themselves:
  • >>Score = 7
  • >>Score = Score
  • >>Score = Score + 1
  • >>print Score Hit return
  • Generates >>8
  • Useful to increment or decrement a value