Introduction to Python

Slides:



Advertisements
Similar presentations
Chapter 7: User-Defined Functions II
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Introduction to Python (for C++ programmers). Background Information History – created in December 1989 by Guido van Rossum Interpreted Dynamically-typed.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Lists in Python.
1 Python CIS*2450 Advanced Programming Concepts Material for this lecture was developed by Dr. D. Calvert.
H3D API Training  Part 3.1: Python – Quick overview.
Strings The Basics. Strings can refer to a string variable as one variable or as many different components (characters) string values are delimited by.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
Python Primer 1: Types and Operators © 2013 Goodrich, Tamassia, Goldwasser1Python Primer.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 1: Introduction.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
RUBY by Ryan Chase.
By Austin Laudenslager AN INTRODUCTION TO PYTHON.
PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Quiz 3 Topics Functions – using and writing. Lists: –operators used with lists. –keywords used with lists. –BIF’s used with lists. –list methods. Loops.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
PHP using MySQL Database for Web Development (part II)
Programming in Go(lang)
Web Database Programming Using PHP
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
EECS 183 Discussion #9: It’s time to “Git” Python! November 22nd, 2016
Ruby: An Introduction Created by Yukihiro Matsumoto in 1993 (named after his birthstone) Pure OO language (even the number 1 is an instance of a class)
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
Web Database Programming Using PHP
Arrays An array in PHP is an ordered map
Quiz 11/15/16 – C functions, arrays and strings
PHP (PHP: Hypertext Preprocessor)
JavaScript Syntax and Semantics
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
CompSci 230 Software Construction
JavaScript: Functions.
Shell scripts on Pegasus 2
Engineering Innovation Center
Introduction to JavaScript
Introduction to Python
JavaScript an introduction.
Introduction to Python
PYTHON Varun Jain & Senior Software Engineer
Python Primer 2: Functions and Control Flow
Topics Introduction to File Input and Output
An Introduction to Java – Part I, language basics
MSIS 655 Advanced Business Applications Programming
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
Topic 1: Problem Solving
Web DB Programming: PHP
Python Primer 1: Types and Operators
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
(more) Python.
Introduction to JavaScript
CISC101 Reminders Assignment 3 due next Friday. Winter 2019
Introduction to Computer Science
Introduction to Programming
PHP an introduction.
Topics Introduction to File Input and Output
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Learning Python 5th Edition
Introduction to Python
Presentation transcript:

Introduction to Python

What is Python (1)? It’s one of the most popular dynamic programming languages It’s a general purpose programming language It’s used for just about everything It’s syntax looks similar to C or Pascal with a few exceptions It’s dynamically typed It’s interpreted

What is Python (2)? It is object-oriented There is an extensive standard library with over 100 modules and growing Regular expressions, mathematical functions, operating system calls, network programming and just about everything else There are many 3rd party modules too supplying GUI toolkits and interfaces to relational databases

Who uses Python? Google has millions of lines of Python code It’s probably more popular than ASP.NET or PHP. Yahoo maps and groups Industrial Light & Magic And the list goes on

Python Variables In this regard, Python is truly object-oriented Every variable is an object Variables can be used before they are declared Numbers are of two types (integers and floating point numbers) myInt = 7 myFloat = 7.0 String are defined with either single or double quotes myString = “hello”

Notes about the Examples Note that many of the examples in these slides were used from www.learnpyton.org

Python Expressions They work the same as expressions in most other languages although you cannot mix operators between numbers and strings

Python Lists Python implements arrays as lists They can contain any type of variables They are easy to iterate Elements can be accessed via an index

Python Strings There are a number of functions that operate on strings Strings also have methods like index, count, upper, lower and so on As in JavaScript + is the strong concatenation operator

Python Blocks Here, Python differs from other languages Indentation is used to define code blocks instead of braces

Python Loops Like most languages, there are for and while loops

Python Functions Python functions are defined using the def keyword Functions can have zero, one, or many arguments Functions can return a value

Python Functions (Calling) Call a function by specifying the function name, followed by () Arguments appear between the () Example to call the function declared in the previous slide Python also works with a variable number of arguments

Python Modules Modules are Python files that implement one or more functions One modules imports another module via the import keyword You can create your own modules by creating a new .py file with the module name.

Python Exception Handling Exceptions happen you a statement tries to do the impossible Python uses the try syntax to handle exceptions

They Python Standard Library The following link documents the Python standard library https://docs.python.org/2/library/

Some Interesting Python Constructs (1) Sets are lists with no duplicate entries They operate on the notion of set theory There are many set methods like intersection, symmetric_difference and difference