Python Tutorial & Cheat Sheet - New York University
Python Tutorial &
Cheat Sheet
Getting Started
What you need: Linux based machine with Python 2.7 or higher (comes default on most linux systems)
(Python on windows also works though not ideal) Editor on Linux such as VI or EMACS to edit your files Python interpreter: operates similar to a unix shell: reads and executes commands interactively Setting your path variable to include the location of the Python interpreter: (usually /usr/local/bin/python
Run python scripts by using the following syntax: $python filename.py
Python Basics
1. Primitives
Numbers
Python has integers and floats. Integers are whole numbers, like 314, 500. Floats, meanwhile, are fractional numbers like 3.14, 2.867, 76.88887 You can use the type method to check the value of an object. >>> type(3) >>> type(3.14) >>> pi = 3.14 >>> type(pi)
Strings
Strings are. used quite often in Python. Strings, are just that, a string of characters. A character is anything you can type on the keyboard in one keystroke, like a letter, a number, or a backslash. Python recognizes single and double quotes as the same thing, the beginning and ends of the strings. >>> "string list" `string list' >>> `string list' you can also join strings with use of variables as well. >>> a = "first" >>> b = "last" >>> a + b `firstlast'
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- hi gdb this is python zenk security
- chapter 3 input and type conversion washington state university
- c coding standards2019
- python cheat sheet
- vectorcast python 2 to python 3 upgrade vector informatik gmbh
- c coding standards2019 university of michigan
- casadi tutorial 2 sourceforge
- python websitesetup
- convert string variables to numeric variables and vice versa stata
- c0 libraries carnegie mellon university
Related searches
- new york university ranking
- new york university transfer
- new york university common app
- new york university medical school
- new york university us news ranking
- new york university graduate school
- new york university transcript
- new york university acceptance rate 2019
- new york university undergraduate admissions
- new york university transcripts request
- new york university transfer admission
- new york university admissions requirements