Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 1 / 9

Similar documents
Lecture 1. basic Python programs, defining functions

Introduction to Python

Table of Contents EVALUATION COPY

CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) First Name: Last Name: NetID:

Python Programming Exercises 1

CS 1110, LAB 1: EXPRESSIONS AND ASSIGNMENTS First Name: Last Name: NetID:

What you get When you install Python for your computer, you get a number of features:

Science One CS : Getting Started

Senthil Kumaran S

A computer program is a set of instructions that causes a computer to perform some kind of action. It isn t the physical parts of a computer like the

Introduction to Python

Shell / Python Tutorial. CS279 Autumn 2017 Rishi Bedi

The >>> is a Python prompt indicating that Python is ready for us to give it a command. These commands are called statements.

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

Professor Hugh C. Lauer CS-1004 Introduction to Programming for Non-Majors

Laboratory Exercise #0

How to program with Matlab (PART 1/3)

Lecture 1. A. Sahu and S. V. Rao. Indian Institute of Technology Guwahati

Today. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3. Installing Notepad++

Get It Interpreter Scripts Arrays. Basic Python. K. Cooper 1. 1 Department of Mathematics. Washington State University. Basics

CS 1331 Introduction to Object Oriented Programming

CSC209. Software Tools and Systems Programming.

Hello, World! An Easy Intro to Python & Programming. Jack Rosenthal

Writing and Running Programs

Linux Command Line Interface. December 27, 2017

STATS 507 Data Analysis in Python. Lecture 0: Introduction and Administrivia

CS1110 Lab 1 (Jan 27-28, 2015)

CS370 Operating Systems

One of the hardest things you have to do is to keep track of three kinds of commands when writing and running computer programs. Those commands are:

L435/L555. Dept. of Linguistics, Indiana University Fall 2016

CSC 015: FUNDAMENTALS OF COMPUTER SCIENCE I

Introduction to Linux

Some material adapted from Upenn cmpe391 slides and other sources

G-WAN. Complete install process for Ubuntu (both for the 32 and the 64 OS versions).

There are two ways to use the python interpreter: interactive mode and script mode. (a) open a terminal shell (terminal emulator in Applications Menu)

Using the Zoo Workstations

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Python Programming: An Introduction to Computer Science

Exploring Python Basics

Operating Systems CS3502 Spring 2018

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

CSCI 121: Anatomy of a Python Script

Linux Essentials. Smith, Roderick W. Table of Contents ISBN-13: Introduction xvii. Chapter 1 Selecting an Operating System 1

Introduction to Python for Scientific Computing

Exploring Python Basics

Introduction to Linux

Programming Languages Part 1. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Bioinformatics? Reads, assembly, annotation, comparative genomics and a bit of phylogeny.

CS101 Lecture 24: Thinking in Python: Input and Output Variables and Arithmetic. Aaron Stevens 28 March Overview/Questions

1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words

Instituto Politécnico de Tomar. Python. Introduction. Ricardo Campos. Licenciatura ITM Técnicas Avançadas de Programação Abrantes, Portugal, 2018

CS4023 Week04 Lab Exercise

Introduction to Linux

DAY 4. CS3600, Northeastern University. Alan Mislove

CS 190C: Introduction to Computational Thinking

Getting Started with Python and the PyCharm IDE

10 cool tools in Windows 7

Introduction to Computer Programming for Non-Majors

Introduction to Computer Programming for Non-Majors CSC 2301, Fall The Department of Computer Science

Makefile Tutorial. Eric S. Missimer. December 6, 2013

CSC209. Software Tools and Systems Programming.

Lab 1 Introduction to UNIX and C

Intermediate Programming, Spring Misha Kazhdan

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

In this third unit about jobs in the Information Technology field we will speak about software development

Bash Programming. Student Workbook

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

Chapter 4. Unix Tutorial. Unix Shell

Programming Languages: Part 1. Robert M. Dondero, Ph.D. Princeton University

10 cool tools in Windows 7

Python Basics. level 1 Chris Roffey

COPYRIGHTED MATERIAL. Installing Xcode. The Xcode Installer

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Compiling C/C++ programs

Computer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: C and Unix Overview

CMSC 201 Spring 2017 Lab 01 Hello World

B a s h s c r i p t i n g

Exercises. Computer Tech Tom Browder Northwest Florida Linux User Group [nwflug.org]

Lab #0 Getting Started Due In Your Lab, August 25, 2004

Welcome to Python 3. Some history

Introduction to Linux. Fundamentals of Computer Science

Dalhousie University CSCI 2132 Software Development Winter 2018 Lab 8, March 22

Introduction to Supercomputing

CSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science

Starting. Read: Chapter 1, Appendix B from textbook.

Laboratory Assignment #3 Eclipse CDT

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Global-Net 2.0d Quick Installation

Programming Project 1: Introduction to the BLITZ Tools

Python Input, output and variables. Lecture 23 COMPSCI111/111G SS 2018

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT

Review of Fundamentals

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Introduction to Python for IBM i

Python for Non-programmers

Python Input, output and variables

Introduction to Programming with Python 3, Ami Gates. Chapter 1: Creating a Programming Environment

Transcription:

http://xkcd.com/353/ Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 1 / 9

Python Python is a general-purpose programming language, meaning you can write any kind of program in Python. 1 The opposite of a general purpose language is a domain-specific language, which is designed for one kind of application. Later we ll learn a domain-specific langauge called SQL which is just for manipulating relational databases. Python is interpreted, meaning you can run programs directly after you write them; you don t have to compile programs to some intermediate form for the operating system or a virtual machine to execute. 1 Python was named for Monty Python, of which Python s creator, Guido van Rossum, is a big fan. This is the single coolest thing about Python. Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 2 / 9

Python Python is dynamically typed, meaning you don t have to specify the types of variables in Python code (you ll see what this means soon). Python was designed to be easy to learn and use. The Python community is huge, which means there are plenty of people to help you with Python, and tons of libraries for all kinds of applications, from web servers to video games. These properties make Python an excellent tool to add to an engineer s tool box. Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 3 / 9

The python3 Program Practically speaking, Python is a program on your computer that interprets Python programs and statements. 2 You can ask python3 a question without running any Python code. For example, this is how you ask which version of Python is installed (Note: the $ character is the command prompt in the Unix Bash shell. The Windows command prompt is C:\>.): $ python3 --version Python 3.4.0 If you get some other response, like command not found, then you haven t properly installed Python. 2 Note that there are two versions of Python in wide use: Python 2 and Python 3. The python program is Python 2, the python3 program is Python 3. In this course we use Python 3. Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 4 / 9

Executing Python Code with python3 You can run a Python program, which has a.py extension by convention: $ python myprogram.py Or you can invoke the interactive Python shell (sometimes called REPL for "Read-Eval-Print Loop"): $ python3 Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> To exit the Python shell type Ctrl-D on Unix, or Ctrl-Z on Windows. Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 5 / 9

Our First Python Program Open your text editor, paste the following code into a buffer (or tab or window or whatever your editor calls it), and save it as hello.py: print("hello, world!") Then open your command shell (terminal on Unix or CMD.exe on Windows), go to the directory where you saved hello.py and enter: $ python3 hello.py Hello, world! will be printed to the console on the next line. Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 6 / 9

Interpreting Python Programs What happened when we entered python3 hello.py at an operating system command shell prompt? 1 python3 told the operating system to load the python interpreter into memory and run it. python3 is the name of an executable file on your hard disk which your OS can find because its directory is on the PATH 2 We invoked python3 with a command line argument, which python3 reads after it starts running 3 Since the command line argument was the name of a file (hello.py), the python3 program treated the file as a Python program, or script, and read the file line by line, executing the Python statements in the file A Python program, or script, is just a sequence of Python statements Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 7 / 9

The Python REPL Invoke the Python interactive shell by entering python3 at your command shell s prompt without any arguments and type in the same line we put in hello.py: $ python3 Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> print("hello, world!") Hello, world! >>> >>> is the command prompt for the Python REPL. The Python interactive shell is also called a REPL, for Read Eval Print Loop, becuase it runs the following loop: Read an expression or statement at the command prompt, Evaluate the expression or execute the statement, and Print the result to the console We ll spend a lot of time in the REPL. Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 8 / 9

A Python Programming Ecosystem For now this is all you need to program in Python: a correctly installed python3, a text editor to create and edit Python programs, and a command shell in which to invoke python3. If you don t have these, install them ASAP. Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 9 / 9