29842_python-tutorial

29842_python-tutorial - A Caffeinated Crash Course in...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
A Caffeinated Crash Course in Python
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Python is not…. • Java • C • Perl
Background image of page 2
The Python Interpreter • Type “python” at the command prompt • In windows, find the python icon on the start menu
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Dir and Help help() dir()
Background image of page 4
Syntax Errors • Python Errors show the line number of the error • Check the line above if your error makes no sense
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
White Space
Background image of page 6
String Basics • Not a mutable data type • String can be delimited with either the “ or ‘
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
More Strings • Concatenation uses the + • You can do math with strings!
Background image of page 8
Output
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Indexing • To index into a string, specify the position inside square brackets • You can index into a string from the “end” of the string.
Background image of page 10
Slicing • A Substring of a string is a slice • Your head or tail can be a negative index
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
More Slicing • You don’t need to specify the beginning and end of the string • Find the length of a string with len()
Background image of page 12
Example
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Lists • Lists in python are made of any data type delimited by commas and surrounded by brackets.
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 28

29842_python-tutorial - A Caffeinated Crash Course in...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online