Intro To Pete Alonzi University of Virginia Library

Slides:



Advertisements
Similar presentations
I210 review Fall 2011, IUB. Python is High-level programming –High-level versus machine language Interpreted Language –Interpreted versus compiled 2.
Advertisements

Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
Introduction to Python. Outline Python IS ……. History Installation Data Structures Flow of Control Functions Modules References.
Intro to Python Paul Martin. History Designed by Guido van Rossum Goal: “Combine remarkable power with very clear syntax” Very popular in science labs.
The Python Programming Language Matt Campbell | Steve Losh.
Introduction to Python (for C++ programmers). Background Information History – created in December 1989 by Guido van Rossum Interpreted Dynamically-typed.
Python Control of Flow.
Programming 101 with Python: an open-source, cross-platform, and fun language By J. Burton Browning, Ed.D. Copyright © J. Burton Browning All rights reserved.
V Avon High School Tech Club Agenda Old Business –Delete Files New Business –Week 18 Topics: Intro to HTML/CSS: Questions? Summer Work Letter.
An Introduction to Textual Programming
Introduction to Python
Hello World 2 What does all that mean?.
1 Python CIS*2450 Advanced Programming Concepts Material for this lecture was developed by Dr. D. Calvert.
CATHERINE AND ANNIE Python: Part 4. Strings  Strings are interesting creatures. Although words are strings, anything contained within a set of quotes.
August 29, 2005ICP: Chapter 1: Introduction to Python Programming 1 Introduction to Computer Programming Chapter 1: Introduction to Python Programming.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
Python – May 11 Briefing Course overview Introduction to the language Lab.
Lists CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
Python. History of python  Python was conceived in the late 1980s and its implementation was started in December 1989 by Guido van Rossum at CWI in the.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 8: Fun with strings.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
By Austin Laudenslager AN INTRODUCTION TO PYTHON.
Python Let’s get started!.
Python Mini-Course University of Oklahoma Department of Psychology Day 3 – Lesson 11 Using strings and sequences 5/02/09 Python Mini-Course: Day 3 – Lesson.
Midterm Review Important control structures Functions Loops Conditionals Important things to review Binary Boolean operators (and, or, not) Libraries (import.
9/2/2015BCHB Edwards Introduction to Python BCHB524 Lecture 1.
Language Find the latest version of this document at
The If Statement There are no switch statements in Python. You need to use just if statements. There are no switch statements in Python. You need to use.
Xi Wang Yang Zhang. 1. Easy to learn 2. Clean and readable codes 3. A lot of useful packages, especially for web scraping and text mining 4. Growing popularity.
Strings CSE 1310 – Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
PYTHON PROGRAMMING. WHAT IS PYTHON?  Python is a high-level language.  Interpreted  Object oriented (use of classes and objects)  Standard library.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
Introduction to python
String and Lists Dr. José M. Reyes Álamo.
Whatcha doin'? Aims: To start using Python. To understand loops.
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
A basic tutorial for fundamental concepts
Introduction to Python
Computer Programming Fundamentals
Department of Computer Science,
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
Engineering Innovation Center
PH2150 Scientific Computing Skills
Intro to Computer Science CS 1510 Dr. Sarah Diesburg
Introduction to Python
basic Python programs, defining functions
Unit 1: Introduction Lesson 1: PArts of a java program
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong.
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Types, Truth, and Expressions (Part 2)
Types, Truth, and Expressions (Part 2)
slides created by Marty Stepp
String and Lists Dr. José M. Reyes Álamo.
CSC1018F: Intermediate Python
A look at Python Programming Language 2018.
Python Basics with Jupyter Notebook
Introduction to Computer Science
Python Review
Benfeard Williams June 16th, 2016
Types, Truth, and Expressions
CMPT 120 Lecture 4 – Unit 1 – Chatbots
Python Basics. Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts.
Intro to Programming (in JavaScript)
Types, Truth, and Expressions (Part 2)
PYTHON - VARIABLES AND OPERATORS
Introduction to Python
Presentation transcript:

Intro To Pete Alonzi University of Virginia Library Research Data Services February 14, 2017

Outline Installation Getting our sea legs – terminals, and text editors, and IDEs Math and variables Functions Python Data Types Loops Logic Import Odds and ends

Installation of Python Two Notes Language (python) vs language distribution (anaconda) Python 2 vs Python 3 https://www.continuum.io/downloads

Programming vs Python For this workshop we are not requiring any previous knowledge of python or of computer programming. As a result we will be explaining fundamental concepts of each. Our emphasis is on the python but we will spend time on programming as well.

Brief history of Python - https://www.python.org/ Designed by Guido van Rossum 1991 successor to the ABC language Python 2.0 was released on 16 October 2000 Python 3.0  was released on 3 December 2008

Let’s Open Spyder

Programs – “Hello World!” In programming the classic first program is called “Hello World!”

Math and Variables Python knows math! 1+2 Python uses variables to reference things (for example some math). X = 1+2 The “=“ is special. It doesn’t mean equals to. It means refers to. Variable

Math and Variables Math operations Variable rules + - * / ** % // + - * / ** % // Variable rules Must start with a letter Have a type

Functions Functions are prewritten pieces of code that perform one specific task. Let’s take a look at type(…) Function code name arguments

Programs – “Hello World!” In programming the classic first program is called “Hello World!”

Data Types - Strings A string is a string of characters “apple” “blue42” “iamtheverymodelofamodernmajorgeneral” “7hills” Helper functions: string.lower(), string.upper() And many more, check out the online docs

Indexing fruit = ‘ a p p l e ‘ 0 1 2 3 4 -5 -4 -3 -2 -1

Data Types – Strings - Slicing Reference elements of a string with […:…] [from:up to but not including]

Data Types - Lists Lists are represented: name[…] Contains a list of elements of various types You can even have a list of lists Lots of helper functions Reference with [...] and can slice too! Don’t forget tuples: name(…) and immutable

Data Types - Dictionary Dicts are represented: name{…} Elements are a pair: key:value The keys are strings and values are anything Lots of helper functions

Loops – FOR For loop syntax: for ___ in ___ : The first blank is a new variable The second blank is an iterable eg: for x in range(10): print x

Loops – WHILE While loop syntax: while <boolean>: The boolean is checked every iteration eg: while i<10: print i; i+=1

If statements Normally your code progresses linearly Use an if statement for a fork in the road Syntax: if <boolean>: ______ else: _______ To chain multiples together use elif

Import modules A great feature of python is modularity. Lots of people have developed lots of good modules. A great module is called numpy Eg: numpy.random.randn() But my favorite module is called pandas Use nltk for text manipulation

Import modules A great feature of python is modularity. Lots of people have developed lots of good modules. A great module is called numpy Eg: numpy.random.randn() But my favorite module is called pandas

Comments Every programming language has a way for you to include text to help explain the code. In python you can make a comment two ways. # everything after a # is commented Everything between ’’’ is a comment ‘’’

File input/output (I/O) Reading from a file

File input/output (I/O) Writing to a file