Python - PowerPoint PPT Presentation

About This Presentation
Title:

Python

Description:

Title: PowerPoint Presentation Created Date: 1/1/1601 12:00:00 AM Document presentation format: On-screen Show (4:3) Other titles: Arial Wingdings Default Design ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 11
Provided by: fur55
Learn more at: http://cs.furman.edu
Category:

less

Transcript and Presenter's Notes

Title: Python


1
Python May 11
  • Briefing
  • Course overview
  • Introduction to the language
  • Lab

2
Python
  • Why computer programming?
  • Computer is a general-purpose machine, born to be
    programmed
  • We want to solve many types of problems
  • Our goals
  • Become multi-lingual
  • Practice with design implementation
  • Learn by doing start simple
  • Help available
  • Textbook, python.org, tutorials

3
Background
  • First released, 1991
  • Guido van Rossum, CWI, Netherlands
  • Dissatisfaction with existing languages
  • High-level, multi-purpose language
  • Relatively easy to learn use (we hope!)
  • Procedural, object oriented or functional
  • Interpreted
  • Interface to OS, file system, Web
  • Some data structures built into language
  • Standard library
  • (More details in sections 1.3 and 1.5)

4
Initial To-Do
  • Essential skills special features of language
  • Routine stuff
  • Source file name ends in .py
  • How to run interpreter (command line or IDE)
  • Program structure
  • I/O
  • Interactive, file formatting
  • Variables, identifiers
  • Doing math
  • Comments, tokens, whitespace, style conventions

5
continued
  • Control structures
  • Asking questions, repeating stuff
  • nesting
  • How to make comparisons
  • Boolean operations and/or/not
  • Functions/procedures parameters, returns
  • Data structures
  • String, dynamically-sized list, etc.
  • Standard (i.e. run-time) library
  • Random numbers, etc.

6
In the end
  • How can you tell if youve mastered a language?
  • Write a game
  • Given a spec or algorithm, can you implement it?
  • You may prefer to do something in Python!
  • You never need to know everything. Know where to
    find stuff quickly
  • This course lies between first 2 prog. courses
  • Youll see more operations applications than in
    the 1st course. Not as theoretical as 2nd
    course.

7
Beginning
  • Versions 2.x and 3.x
  • Lab lets use IDE such as ActivePython
  • Free, simple, includes debugger ?
  • Code can by entered
  • directly in shell (good for experimenting!)
  • in a file, which we can save and reuse later

8
Initial nuts bolts
  • Comments begin with , go to end of line
  • Statements dont end in semicolon
  • Dont arbitrarily indent code
  • Put \ at end of line to continue statement
  • Variables are not declared
  • Interactive output
  • Version 2.6 print statement print
    name
  • Version 3.0 print function print
    (name)

9
continued
  • Examples
  • print Hello, world
  • print 743
  • Interactive input
  • input( ) for getting a number
  • raw_input( ) for getting a string
  • name raw_input(What is your name)

10
Whats next?
  • Lab
  • Please read chapter 2
  • Practice with
  • Basic I/O
  • Mathematical operations
  • Strings
  • Simple if statement
  • Simple loop
Write a Comment
User Comments (0)
About PowerShow.com