DREXEL CS 265 - Intro_to_Python_eap54 (26 pages)

Previewing pages 1, 2, 3, 24, 25, 26 of 26 page document View the full content.
View Full Document

Intro_to_Python_eap54



Previewing pages 1, 2, 3, 24, 25, 26 of actual document.

View the full content.
View Full Document
View Full Document

Intro_to_Python_eap54

132 views

Lecture Notes


Pages:
26
School:
Drexel University
Course:
Cs 265 - Advanced Programming Tools and Techniques

Unformatted text preview:

Introduction to Python What is Python Interpreted object oriented high level programming language No compiling or linking neccesary Extensible add new functions or modules to the interpreter Benefits Offers more structure and support for large programs than shell and batch files Modules can be reused No compilation saves development time Easy to read syntax The Interpreter Similar to UNIX Reads and executes commands interactively When called with a file name argument it reads and executes a script from that file Invoking is simple python or python c command arg Script name and additional arguments are passed to sys argv When commands are read from a tty the interpreter is said to be in interactive mode Primary Prompt Secondary Prompt Continuation lines are needed when entering a multiline construct As an example take a look at this if statement Example the world is flat 1 if the world is flat print Be careful not to fall off Be careful not to fall off Using Python as a Calculator 2 2 4 This is a comment 2 2 4 2 2 and a comment on the same line as code 4 50 5 6 4 5 0 8 5 Fractions aren t lost when dividing integers 1 6 Using Variables width 20 height 5 9 width height 900 0 0 0 x y z 0 Zero x y and z x y z Using Variables try to access an undefined variable n Traceback most recent call last File stdin line 1 in module NameError name n is not defined last printed expression is stored as price tax 12 5625 price 113 0625 Strings spam eggs spam eggs doesn t doesn t doesn t doesn t Yes he said Yes he said Yes he said Yes he said Isn t she said Isn t she said New lines hello This is a rather long string containing n several lines of text just as you would do in C n Note that whitespace at the beginning of the line is significant print hello This is a rather long string containing several lines of text just as you would do in C Note that whitespace at the beginning of the line is significant Manipulating Strings word Help A word HelpA word 5 HelpAHelpAHelpAHelpAHelpA str ing



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Intro_to_Python_eap54 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Intro_to_Python_eap54 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?