Outline. Simple types in Python Collections Processing collections Strings Tips. 1 On Python language. 2 How to use Python. 3 Syntax of Python
|
|
- Lindsay Cummings
- 5 years ago
- Views:
Transcription
1 Outline 1 On Python language Marcin Młotkowski Object oriented programming 1 / 52
2 On Python language The beginnings of Pythons 90 CWI Amsterdam, Guido van Rossum Marcin Młotkowski Object oriented programming 2 / 52
3 Current state Python Software Foundation (PSF) Marcin Młotkowski Object oriented programming 3 / 52
4 Current version 2.* (2.4, 2.6, 2.7.2) 3.* (3.2.2) Marcin Młotkowski Object oriented programming 4 / 52
5 Why I like Python On Python language Simple and clean syntax: factorial few keywords and operators; indentation is obligatory def fact(x): if x == 0: return 1 else : return x * fact(x-1) Marcin Młotkowski Object oriented programming 5 / 52
6 Why Python is so cool Styles of programming structural programming object oriented programming functional programming Marcin Młotkowski Object oriented programming 6 / 52
7 Why Python is so cool Built-in types Lists vec = [1, 2, 3] doubled_vec = [ 2*e for e in vec] Dictionaries phone = { chris : , Susie : } print tel[ susie ] Marcin Młotkowski Object oriented programming 7 / 52
8 Why Python is so cool Batteries included I/O libraries regular expressions HTTP, HTML, XML GUIs: pygtk, wxpython, Tkinter, PythonWin Marcin Młotkowski Object oriented programming 8 / 52
9 Other features of Python Dynamic type system >>> 2 + "two" Traceback (most recent call last): File "<stdin>", line 1, in? TypeError: unsupported operand type(s) for +: int and str >>> Marcin Młotkowski Object oriented programming 9 / 52
10 Applications of Python Projects System tools (RedHat) Google NASA ZOPE/PLONE Marcin Młotkowski Object oriented programming 10 / 52
11 Outline 1 On Python language Marcin Młotkowski Object oriented programming 11 / 52
12 Interactive mode $ python >>> >>> [1,2,3][-1:] [3] Ctrl-d $ Marcin Młotkowski Object oriented programming 12 / 52
13 Execute a file $ python a_file.py What s happened 1 program compilation (inc. syntax checking) Marcin Młotkowski Object oriented programming 13 / 52
14 Execute a file $ python a_file.py What s happened 1 program compilation (inc. syntax checking) 2 sometimes a file *.pyc is created Marcin Młotkowski Object oriented programming 13 / 52
15 Execute a file $ python a_file.py What s happened 1 program compilation (inc. syntax checking) 2 sometimes a file *.pyc is created 3 execute a program Marcin Młotkowski Object oriented programming 13 / 52
16 Outline 1 On Python language Marcin Młotkowski Object oriented programming 14 / 52
17 Syntax Assignment four = x = y = z = 0 name = Pyt + hon primes = [2, 3, 5, 7] a, b = b, a+b Marcin Młotkowski Object oriented programming 15 / 52
18 Syntax Conditional statement x = 4 if x % 2 == 0: print "even" print "x = ", 2 x = 4 if x % 2 == 0: print "even" print "x = ", 2 Marcin Młotkowski Object oriented programming 16 / 52
19 Syntax Conditional statement x = 400 if x % 2 == 0: if x > 100: print "large even" elif 10 < x <= 100: print "small even" else: print "tiny even" Marcin Młotkowski Object oriented programming 17 / 52
20 Logic expressions On Python language false: 0, False, None, [], Marcin Młotkowski Object oriented programming 18 / 52
21 Logic expressions On Python language false: 0, False, None, [], true: True, nonempty values Marcin Młotkowski Object oriented programming 18 / 52
22 Logic expressions On Python language false: 0, False, None, [], true: True, nonempty values conjunctions: and, or, not Marcin Młotkowski Object oriented programming 18 / 52
23 Logic expressions On Python language false: 0, False, None, [], true: True, nonempty values conjunctions: and, or, not operators: ==,!=, 1 < x < 2 Marcin Młotkowski Object oriented programming 18 / 52
24 Loop statement A statement while a, b = 0, 1 while b < 10: print b a, b = b, a + b Marcin Młotkowski Object oriented programming 19 / 52
25 Loop statement for in a = [1,2,3,4] for e in a: print e print "end" Marcin Młotkowski Object oriented programming 20 / 52
26 Loop statements On Python language for in sum = 0 for i in range(100): sum = sum + i print "sum=", sum Marcin Młotkowski Object oriented programming 21 / 52
27 Other statements On Python language break and continue empty statement: pass while (True): pass Marcin Młotkowski Object oriented programming 22 / 52
28 Functions def foo(arg1, arg2=1, arg3=[3]): print arg1, arg2, arg3 return 4 foo("one", 2) print foo(1, 2, 3) Marcin Młotkowski Object oriented programming 23 / 52
29 Comments def fun (arg): """ This is very important function Use with high esteem""" # end if empty argument if arg == None: return return arg Marcin Młotkowski Object oriented programming 24 / 52
30 Input/output Python 2.* print "Hello world" x = input("type x: ") y = input("type y: ") print "x =", x, " y =", y Marcin Młotkowski Object oriented programming 25 / 52
31 Input/output Python 2.* print "Hello world" x = input("type x: ") y = input("type y: ") print "x =", x, " y =", y Python 3.0 print("hello world") x = input("type x: ") y = input("type y: ") print("x =", x, " y =", y) Marcin Młotkowski Object oriented programming 25 / 52
32 Editors with syntax highlighting: vim, gedit, emacs Marcin Młotkowski Object oriented programming 26 / 52
33 Editors with syntax highlighting: vim, gedit, emacs Tools idle PythonCard/codeEditor Marcin Młotkowski Object oriented programming 26 / 52
34 file.py Editors with syntax highlighting: vim, gedit, emacs Tools idle PythonCard/codeEditor "Executable"files and national characters: #!/usr/bin/python # -*- coding: iso *- Marcin Młotkowski Object oriented programming 26 / 52
35 Why "Python"? Marcin Młotkowski Object oriented programming 27 / 52
36 Further reading "Dive into Python", Mark Pilgrim... Marcin Młotkowski Object oriented programming 28 / 52
37 Outline On Python language 1 On Python language Marcin Młotkowski Object oriented programming 29 / 52
38 Simple types On Python language simple types: integers, floats, booleans sequential types: strings, lists, tuples Marcin Młotkowski Object oriented programming 30 / 52
39 Simple integers On Python language Range: [ sys.maxint 1, sys.maxint] Operators: +, -, /, //, %, ** Standard functions: abs(x), divmod(x, y) = (x // y, x % y) Warning Dividing integer by integer gives integer 4//3 = 1 Marcin Młotkowski Object oriented programming 31 / 52
40 Integers and conversions (1.0 4)//3 = 1.0 (1.0 4)/3 = float(4)/3 = 4/float(3) Marcin Młotkowski Object oriented programming 32 / 52
41 Large integers On Python language Example >>> 1000 ** L >>> long(100) 100L Marcin Młotkowski Object oriented programming 33 / 52
42 Constants On Python language Integers 0x123, 0x L, 0123, 06789L Floats e1 Marcin Młotkowski Object oriented programming 34 / 52
43 Complex numbers On Python language Literals and expressions 1 + 3j x + 12j complex(x, 0) Operators x.real 2 + y.imag 2 Marcin Młotkowski Object oriented programming 35 / 52
44 Standard numerical libraries math import math print math.cos(3.14) random from random import * print random() Marcin Młotkowski Object oriented programming 36 / 52
45 Examples On Python language Lists: [12,3] : "abc", def, u Zażółć żółtą jaźń tuples: (1, one, (1, 2+3j, 0x4)) dictionaries Sets Marcin Młotkowski Object oriented programming 37 / 52
46 Tuple On Python language brown = 165, 42, 42 NavyBlue = (0,0,128) htmlcolor = { turquoise : (64,224,208), NavyBlue : NavyBlue } r, g, b = htmlcol[ NavyBlue ] Marcin Młotkowski Object oriented programming 38 / 52
47 Reminder On Python language assignment a, b = 1, 2 Marcin Młotkowski Object oriented programming 39 / 52
48 Reminder On Python language assignment (a, b)= (1, 2) Marcin Młotkowski Object oriented programming 39 / 52
49 Inclusion operator On Python language in bc in abcd 4 not in [2, 3, 5, 7, 11] pi in { pi : , e : } Marcin Młotkowski Object oriented programming 40 / 52
50 Collection operators On Python language + >>> [ one, 2, 3.0 ] + [ 0x4, 05 ] [ one, 2, 3.0, 4, 5] >>> ( one, 2, 3.0) + (0x4, 05) ( one, 2, 3.0, 4, 5) Marcin Młotkowski Object oriented programming 41 / 52
51 Size of collection On Python language len len( [ one, 2, 3.0] ) len( { one : 1, two : 2 } ) len( (1, 2, 3) ) Marcin Młotkowski Object oriented programming 42 / 52
52 Elements of collections [1, 2, 3][2] = 3 Marcin Młotkowski Object oriented programming 43 / 52
53 Elements of collections [1, 2, 3][2] = 3 abcd [1:3] = bc Marcin Młotkowski Object oriented programming 43 / 52
54 Elements of collections [1, 2, 3][2] = 3 abcd [1:3] = bc (1, 2, 3)[1:] = (2, 3) Marcin Młotkowski Object oriented programming 43 / 52
55 Elements of collections [1, 2, 3][2] = 3 abcd [1:3] = bc (1, 2, 3)[1:] = (2, 3) (1,2,3)[:1] = (1, ) Marcin Młotkowski Object oriented programming 43 / 52
56 Elements of collections [1, 2, 3][2] = 3 abcd [1:3] = bc (1, 2, 3)[1:] = (2, 3) (1,2,3)[:1] = (1, ) Python [:-1] = Pytho Marcin Młotkowski Object oriented programming 43 / 52
57 Elements of collections [1, 2, 3][2] = 3 abcd [1:3] = bc (1, 2, 3)[1:] = (2, 3) (1,2,3)[:1] = (1, ) Python [:-1] = Pytho Python [-1:] = Python [-1] = n Marcin Młotkowski Object oriented programming 43 / 52
58 Slicing On Python language >>> informatics [::3] ioac Marcin Młotkowski Object oriented programming 44 / 52
59 Iterations over collections x = [1,2,3] y = [4,5,6] prod = 0 for i in range(len(x)): prod += x[i] * y[i] Marcin Młotkowski Object oriented programming 45 / 52
60 List processing On Python language x = [1,2,3] y = [4,5,6] prod = 0 for i, v in enumerate(x): prod += v * y[i] print prod Marcin Młotkowski Object oriented programming 46 / 52
61 List processing, other implementation x = [1,2,3] y = [4,5,6] prod = 0 for a, b in zip(x, y): prod += a * b print prod Marcin Młotkowski Object oriented programming 47 / 52
62 Dictionary processing iteration dict = { uno : 1, duo : 2, tre : 3 } for key, val in dict.iteritems(): print key, "=", val Marcin Młotkowski Object oriented programming 48 / 52
63 Constants On Python language Alice has a cat Alice has a cat Marcin Młotkowski Object oriented programming 49 / 52
64 Constants On Python language Alice has a cat Alice has a cat Unicode uźażółć żółtą jaźń" "Zażółć żółtą jaźń" Marcin Młotkowski Object oriented programming 49 / 52
65 Constants On Python language Alice has a cat Alice has a cat Unicode uźażółć żółtą jaźń" "Zażółć żółtą jaźń" Unicode len(u"żółty") == 5 len("żółty") == 8 Marcin Młotkowski Object oriented programming 49 / 52
66 Constants On Python language Alice has a cat Alice has a cat Unicode uźażółć żółtą jaźń" "Zażółć żółtą jaźń" Unicode len(u"żółty") == 5 len("żółty") == 8 Long strings """This is a multiline string"""" Marcin Młotkowski Object oriented programming 49 / 52
67 On Python language are collections raw strings: r abcd\n String continuation: "This is a \n\ very long string\n" A lot of library functions are immutable, ie. abc [1] = d Marcin Młotkowski Object oriented programming 50 / 52
68 String formatting On Python language Operator % print "%i + %i = %i\n" % (2, 2, 2+2) dict = { two : 2, four : 4 } print "%(two)s + %(two)s = %(four)s\n" % dict Marcin Młotkowski Object oriented programming 51 / 52
69 First aid On Python language Interactive mode >>> type(3.1415) <type float > >>> dir(float)... >>> dir(3.1415)... >>> float. doc Marcin Młotkowski Object oriented programming 52 / 52
Senthil Kumaran S
Senthil Kumaran S http://www.stylesen.org/ Agenda History Basics Control Flow Functions Modules History What is Python? Python is a general purpose, object-oriented, high level, interpreted language Created
More informationCIS192: Python Programming
CIS192: Python Programming Introduction Harry Smith University of Pennsylvania January 18, 2017 Harry Smith (University of Pennsylvania) CIS 192 Lecture 1 January 18, 2017 1 / 34 Outline 1 Logistics Rooms
More informationThe current topic: Python. Announcements. Python. Python
The current topic: Python Announcements! Introduction! reasons for studying languages! language classifications! simple syntax specification Object-oriented programming: Python Types and values Syntax
More informationIntroduction to Python
Introduction to Python Michael Krisper Thomas Wurmitzer October 21, 2014 Michael Krisper, Thomas Wurmitzer Introduction to Python October 21, 2014 1 / 26 Schedule Tutorium I Dates & Deadlines Submission
More informationInteractive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D
1/58 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
More informationInteractive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D
1/60 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
More informationCHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS
CHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS 1439-1440 1 Outline 1. Introduction 2. Why Python? 3. Compiler and Interpreter 4. The first program 5. Comments and Docstrings 6. Python Indentations
More informationCIS192 Python Programming. Robert Rand. August 27, 2015
CIS192 Python Programming Introduction Robert Rand University of Pennsylvania August 27, 2015 Robert Rand (University of Pennsylvania) CIS 192 August 27, 2015 1 / 30 Outline 1 Logistics Grading Office
More informationTable of Contents EVALUATION COPY
Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...
More informationA Little Python Part 1. Introducing Programming with Python
A Little Python Part 1 Introducing Programming with Python Preface Not a complete course in a programming language Many details can t be covered Need to learn as you go My programming style is not considered
More informationSome material adapted from Upenn cmpe391 slides and other sources
Some material adapted from Upenn cmpe391 slides and other sources History Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics
More informationFundamentals of Programming (Python) Getting Started with Programming
Fundamentals of Programming (Python) Getting Started with Programming Ali Taheri Sharif University of Technology Some slides have been adapted from Python Programming: An Introduction to Computer Science
More informationBeyond Blocks: Python Session #1
Beyond Blocks: Session #1 CS10 Spring 2013 Thursday, April 30, 2013 Michael Ball Beyond Blocks : : Session #1 by Michael Ball adapted from Glenn Sugden is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike
More informationPython Programming, bridging course 2011
Python Programming, bridging course 2011 About the course Few lectures Focus on programming practice Slides on the homepage No course book. Using online resources instead. Online Python resources http://www.python.org/
More informationIntroductory Linux Course. Python I. Martin Dahlö UPPMAX. Author: Nina Fischer. Dept. for Cell and Molecular Biology, Uppsala University
Introductory Linux Course Martin Dahlö UPPMAX Author: Nina Fischer Dept. for Cell and Molecular Biology, Uppsala University August, 2018 Outline Python basics get started with Python Data types Control
More informationProgramming to Python
Programming to Python Sept., 5 th Slides by M. Stepp, M. Goldstein, M. DiRamio, and S. Shah Compiling and interpreting Many languages require you to compile (translate) your program into a form that the
More informationCSCE 110 Programming I Basics of Python: Variables, Expressions, Input/Output
CSCE 110 Programming I Basics of Python: Variables, Expressions, Input/Output Dr. Tiffani L. Williams Department of Computer Science and Engineering Texas A&M University Spring 2011 Python Python was developed
More informationIntroduction to Python (All the Basic Stuff)
Introduction to Python (All the Basic Stuff) 1 Learning Objectives Python program development Command line, IDEs, file editing Language fundamentals Types & variables Expressions I/O Control flow Functions
More informationDaMPL. Language Reference Manual. Henrique Grando
DaMPL Language Reference Manual Bernardo Abreu Felipe Rocha Henrique Grando Hugo Sousa bd2440 flt2107 hp2409 ha2398 Contents 1. Getting Started... 4 2. Syntax Notations... 4 3. Lexical Conventions... 4
More informationGetting Started with Python
Fundamentals of Programming (Python) Getting Started with Python Sina Sajadmanesh Sharif University of Technology Some slides have been adapted from Python Programming: An Introduction to Computer Science
More informationIntroduction to Python
Introduction to Python Michael Krisper Thomas Wurmitzer March 22, 2014 Michael Krisper, Thomas Wurmitzer Introduction to Python March 22, 2014 1 / 27 Schedule Tutorium Dates & Deadlines Submission System
More informationPython BASICS. Introduction to Python programming, basic concepts: formatting, naming conventions, variables, etc.
Python BASICS Introduction to Python programming, basic concepts: formatting, naming conventions, variables, etc. Identikit First appeared in 1991 Designed by Guido van Rossum General purpose High level
More informationThere are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:
Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: 1-123 +456 2. Long integers, of unlimited
More information06/11/2014. Subjects. CS Applied Robotics Lab Gerardo Carmona :: makeroboticsprojects.com June / ) Beginning with Python
CS95003 - Applied Robotics Lab Gerardo Carmona :: makeroboticsprojects.com June / 2014 Subjects 1) Beginning with Python 2) Variables 3) Strings 4) Basic arithmetic operators 5) Flow control 6) Comparison
More informationMEIN 50010: Python Flow Control
: Python Fabian Sievers Higgins Lab, Conway Institute University College Dublin Wednesday, 2017-10-11 Program Overview Program Code Block Statements Expressions Expressions & Statements An expression has
More informationSequence types. str and bytes are sequence types Sequence types have several operations defined for them. Sequence Types. Python
Python Sequence Types Sequence types str and bytes are sequence types Sequence types have several operations defined for them Indexing Python Sequence Types Each element in a sequence can be extracted
More informationIntroductory Linux Course. Python I. Pavlin Mitev UPPMAX. Author: Nina Fischer Dept. for Cell and Molecular Biology, Uppsala University
Introductory Linux Course Python I Pavlin Mitev UPPMAX Author: Nina Fischer Dept. for Cell and Molecular Biology, Uppsala University August, 2017 Outline Python introduction Python basics get started with
More informationHistory Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability
History Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability Some material adapted from Upenn cmpe391 slides and other sources Invented in the Netherlands,
More informationMEIN 50010: Python Introduction
: Python Fabian Sievers Higgins Lab, Conway Institute University College Dublin Wednesday, 2017-10-04 Outline Goals Teach basic programming concepts Apply these concepts using Python Use Python Packages
More information2.Raspberry PI: Architecture & Hardware Specifications
Course Contents: 1.Introduction to RASPBERRY PI Introduction to Open Source Hardware About Raspberry PI Brief Introduction to Hardware Parts & Usability 2.Raspberry PI: Architecture & Hardware Specifications
More informationAnd Parallelism. Parallelism in Prolog. OR Parallelism
Parallelism in Prolog And Parallelism One reason that Prolog is of interest to computer scientists is that its search mechanism lends itself to parallel evaluation. In fact, it supports two different kinds
More informationPYTHON FOR KIDS A Pl ayfu l I ntrodu ctio n to Prog r am m i ng J a s o n R. B r i g g s
PYTHON FO R K I D S A P l ay f u l I n t r o d u c t i o n to P r o g r a m m i n g Jason R. Briggs Index Symbols and Numbers + (addition operator), 17 \ (backslash) to separate lines of code, 235 in strings,
More informationPart I. Wei Tianwen. A Brief Introduction to Python. Part I. Wei Tianwen. Basics. Object Oriented Programming
2017 Table of contents 1 2 Integers and floats Integer int and float float are elementary numeric types in. integer >>> a=1 >>> a 1 >>> type (a) Integers and floats Integer int and float
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More informationLarge-Scale Networks
Large-Scale Networks 3b Python for large-scale networks Dr Vincent Gramoli Senior lecturer School of Information Technologies The University of Sydney Page 1 Introduction Why Python? What to do with Python?
More informationPython 1: Intro! Max Dougherty Andrew Schmitt
Python 1: Intro! Max Dougherty Andrew Schmitt Computational Thinking Two factors of programming: The conceptual solution to a problem. Solution syntax in a programming language BJC tries to isolate and
More informationPython for C programmers
Python for C programmers The basics of Python are fairly simple to learn, if you already know how another structured language (like C) works. So we will walk through these basics here. This is only intended
More informationCSc 120. Introduc/on to Computer Programing II. Adapted from slides by Dr. Saumya Debray. 01- a: Python review
CSc 120 Introduc/on to Computer Programing II Adapted from slides by Dr. Saumya Debray 01- a: Python review python review: variables, expressions, assignment 2 python basics x = 4 y = 5 z = x + y x 4 y
More informationIntroduction to Python
Introduction to Python CB2-101 Introduction to Scientific Computing November 11 th, 2014 Emidio Capriotti http://biofold.org/emidio Division of Informatics Department of Pathology Python Python high-level
More informationTypes, lists & functions
Week 2 Types, lists & functions Data types If you want to write a program that allows the user to input something, you can use the command input: name = input (" What is your name? ") print (" Hello "+
More informationCS Programming Languages: Python
CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer
More informationIntroduction to Python
Introduction to Python EECS 4415 Big Data Systems Tilemachos Pechlivanoglou tipech@eecs.yorku.ca 2 Background Why Python? "Scripting language" Very easy to learn Interactive front-end for C/C++ code Object-oriented
More informationD R S H YA M N C H AW D A
PYTHON D R S H YA M N C H AW D A HISTORY Guido Van Rossum Amoeba distributed operating system group Rossum was fan of a comedy series from late seventies. WHO USE PYTHON? Google - Python is one of the
More informationPython Intro GIS Week 1. Jake K. Carr
GIS 5222 Week 1 Why Python It s simple and easy to learn It s free - open source! It s cross platform IT S expandable!! Why Python: Example Consider having to convert 1,000 shapefiles into feature classes
More informationProgramming in Python
Programming in Python Session-I Indian Institute of Space Science and Technology Thiruvananthapuram, Kerala, India 695547 IEEE Student Branch & Computer Science and Engineering Club, IIST Workshop plan
More informationControl Structures 1 / 17
Control Structures 1 / 17 Structured Programming Any algorithm can be expressed by: Sequence - one statement after another Selection - conditional execution (not conditional jumping) Repetition - loops
More informationPython Workshop. January 18, Chaitanya Talnikar. Saket Choudhary
Chaitanya Talnikar Saket Choudhary January 18, 2012 Python Named after this : Python Slide 1 was a joke! Python Slide 1 was a joke! Python : Conceived in late 1980s by Guido van Rossum as a successor to
More informationIntroduction to Python
Introduction to Python Development Environments what IDE to use? 1. PyDev with Eclipse 2. Sublime Text Editor 3. Emacs 4. Vim 5. Atom 6. Gedit 7. Idle 8. PIDA (Linux)(VIM Based) 9. NotePad++ (Windows)
More informationhttps://lambda.mines.edu Why study Python in Principles of Programming Languages? Multi-paradigm Object-oriented Functional Procedural Dynamically typed Relatively simple with little feature multiplicity
More informationLesson 4: Type Conversion, Mutability, Sequence Indexing. Fundamentals of Text Processing for Linguists Na-Rae Han
Lesson 4: Type Conversion, Mutability, Sequence Indexing Fundamentals of Text Processing for Linguists Na-Rae Han Objectives Python data types Mutable vs. immutable object types How variable assignment
More informationPython 3000 and You. Guido van Rossum PyCon March 14, 2008
Python 3000 and You Guido van Rossum PyCon March 14, 2008 Why Py3k Open source needs to move or die Matz (creator of Ruby) To fix early, sticky design mistakes e.g. classic classes, int division, print
More informationPython. Department of Computer Science And Engineering. European University Cyprus
1 Python VICKY PAPADOPOULOU LESTA, Assistant Professor, Member at AHPC group MICHALIS KYPRIANOU, member of the AHPC group(internship project) Department of Computer Science And Engineering European University
More informationHere n is a variable name. The value of that variable is 176.
UNIT II DATA, EXPRESSIONS, STATEMENTS 9 Python interpreter and interactive mode; values and types: int, float, boolean, string, and list; variables, expressions, statements, tuple assignment, precedence
More informationPython source materials
xkcd.com/353 Python source materials Bob Dondero s Python summary from Spring 2011 http://www.cs.princeton.edu/courses/archive/spring11/cos333/ reading/pythonsummary.pdf bwk s Python help file: http://
More informationCSE : Python Programming
CSE 399-004: Python Programming Lecture 08: Graphical User Interfaces with wxpython March 12, 2005 http://www.seas.upenn.edu/~cse39904/ Plan for today and next time Today: wxpython (part 1) Aside: Arguments
More informationIntroduction to Python
Introduction to Python خانه ریاضیات اصفهان فرزانه کاظمی زمستان 93 1 Why Python? Python is free. Python easy to lean and use. Reduce time and length of coding. Huge standard library Simple (Python code
More informationPython I. Some material adapted from Upenn cmpe391 slides and other sources
Python I Some material adapted from Upenn cmpe391 slides and other sources Overview Names & Assignment Data types Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics
More informationPython. Tutorial Lecture for EE562 Artificial Intelligence for Engineers
Python Tutorial Lecture for EE562 Artificial Intelligence for Engineers 1 Why Python for AI? For many years, we used Lisp, because it handled lists and trees really well, had garbage collection, and didn
More informationGIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes
GIS 4653/5653: Spatial Programming and GIS More Python: Statements, Types, Functions, Modules, Classes Statement Syntax The if-elif-else statement Indentation and and colons are important Parentheses and
More informationCPSC 217 Midterm (Python 3 version)
CPSC 217 Midterm (Python 3 version) Duration: 50 minutes 6 March 2009 This exam has 61 questions and 11 pages. This exam is closed book. No notes, books, calculators or electronic devices, or other assistance
More informationGetting Started. Office Hours. CSE 231, Rich Enbody. After class By appointment send an . Michigan State University CSE 231, Fall 2013
CSE 231, Rich Enbody Office Hours After class By appointment send an email 2 1 Project 1 Python arithmetic Do with pencil, paper and calculator first Idle Handin Help room 3 What is a Computer Program?
More informationChapter 3 : Informatics Practices. Class XI ( As per CBSE Board) Python Fundamentals. Visit : python.mykvs.in for regular updates
Chapter 3 : Informatics Practices Class XI ( As per CBSE Board) Python Fundamentals Introduction Python 3.0 was released in 2008. Although this version is supposed to be backward incompatibles, later on
More informationCSCE 110 Programming I
CSCE 110 Programming I Basics of Python (Part 1): Variables, Expressions, and Input/Output Dr. Tiffani L. Williams Department of Computer Science and Engineering Texas A&M University Spring 2013 Tiffani
More informationCPSC 217-T03/T08. Functions Ruting Zhou
CPSC 217-T03/T08 Functions Ruting Zhou STORED (AND REUSED) STEPS def hello(): Program: print 'Hello' hello() print Zip print 'Fun' def hello(): print('hello ) print('fun ) hello() Print( 'Zip'hello())
More informationPython Tutorial. Day 1
Python Tutorial Day 1 1 Why Python high level language interpreted and interactive real data structures (structures, objects) object oriented all the way down rich library support 2 The First Program #!/usr/bin/env
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationCMPT 120 Basics of Python. Summer 2012 Instructor: Hassan Khosravi
CMPT 120 Basics of Python Summer 2012 Instructor: Hassan Khosravi Python A simple programming language to implement your ideas Design philosophy emphasizes code readability Implementation of Python was
More informationAdvanced Python. Executive Summary, Session 1
Advanced Python Executive Summary, Session 1 OBJECT: a unit of data of a particular type with characteristic functionality (i.e., methods and/or use with operators). Everything in Python is an object.
More informationCOMP519 Web Programming Lecture 17: Python (Part 1) Handouts
COMP519 Web Programming Lecture 17: Python (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents
More information(CC)A-NC 2.5 by Randall Munroe Python
http://xkcd.com/353/ (CC)A-NC 2.5 by Randall Munroe Python Python: Operative Keywords Very high level language Language design is focused on readability Mulit-paradigm Mix of OO, imperative, and functional
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence
More informationPython at Glance. a really fast (but complete) ride into the Python hole. Paolo Bellagente - ES3 - DII - UniBS
Python at Glance a really fast (but complete) ride into the Python hole. Paolo Bellagente - ES3 - DII - UniBS Python 2.7 isn t compatible with python 3!!!! Rule #1: RTFM Read The F*****g Funny Manual Rule
More informationPython for Non-programmers
Python for Non-programmers A Gentle Introduction 2 Yann Tambouret Scientific Computing and Visualization Information Services & Technology Boston University 111 Cummington St. yannpaul@bu.edu Winter 2013
More informationFlow Control: Branches and loops
Flow Control: Branches and loops In this context flow control refers to controlling the flow of the execution of your program that is, which instructions will get carried out and in what order. In the
More informationMultimedia-Programmierung Übung 1
Multimedia-Programmierung Übung 1 Ludwig-Maximilians-Universität München Sommersemester 2009 Ludwig-Maximilians-Universität München Multimedia-Programmierung 1-1 Übungsbetrieb Informationen zu den Übungen:
More informationpython 01 September 16, 2016
python 01 September 16, 2016 1 Introduction to Python adapted from Steve Phelps lectures - (http://sphelps.net) 2 Python is interpreted Python is an interpreted language (Java and C are not). In [1]: 7
More information1 RPN (Danny Yoo / Donovan Preston)
1 RPN (Danny Yoo / Donovan Preston) This code implements a reverse polish notation calculator. It s deliberately written in a slightly weird way to avoid being taken used as a homework answer. 1 """ RPN
More informationPython review. 1 Python basics. References. CS 234 Naomi Nishimura
Python review CS 234 Naomi Nishimura The sections below indicate Python material, the degree to which it will be used in the course, and various resources you can use to review the material. You are not
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationIntroduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1
Review Midterm Exam 1 Review Midterm Exam 1 Exam on Monday, October 7 Data Types and Variables = Data Types and Variables Basic Data Types Integers Floating Point Numbers Strings Data Types and Variables
More informationOverview of List Syntax
Lists and Sequences Overview of List Syntax x = [0, 0, 0, 0] Create list of length 4 with all zeroes x 4300112 x.append(2) 3 in x x[2] = 5 x[0] = 4 k = 3 Append 2 to end of list x (now length 5) Evaluates
More informationlambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions
Outline 1 Guessing Secrets functions returning functions oracles and trapdoor functions 2 anonymous functions lambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions
More informationPython. Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar. December 28, Outline
Python Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar December 28, 2011 1 Outline Introduction Installation and Use Distinct Features Python Basics Functional Example Comparisons with
More informationGE PROBLEM SOVING AND PYTHON PROGRAMMING. Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING
GE8151 - PROBLEM SOVING AND PYTHON PROGRAMMING Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING 1) Define Computer 2) Define algorithm 3) What are the two phases in algorithmic problem solving? 4) Why
More informationIntroduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15
1 LECTURE 1: INTRO Introduction to Scientific Python, CME 193 Jan. 9, 2014 web.stanford.edu/~ermartin/teaching/cme193-winter15 Eileen Martin Some slides are from Sven Schmit s Fall 14 slides 2 Course Details
More informationCrash Dive into Python
ECPE 170 University of the Pacific Crash Dive into Python 2 Lab Schedule Today Ac:vi:es Endianness Python Thursday Network programming Lab 8 Network Programming Lab 8 Assignments Due Due by Mar 30 th 5:00am
More informationPython A Technical Introduction. James Heliotis Rochester Institute of Technology December, 2009
Python A Technical Introduction James Heliotis Rochester Institute of Technology December, 2009 Background & Overview Beginnings Developed by Guido Van Rossum, BDFL, in 1990 (Guido is a Monty Python fan.)
More informationThe Pyth Language. Administrivia
Administrivia The Pyth Language Lecture 5 Please make sure you have registered your team, created SSH keys as indicated on the admin page, and also have electronically registered with us as well. Prof.
More informationBuilt-in Types of Data
Built-in Types of Data Types A data type is set of values and a set of operations defined on those values Python supports several built-in data types: int (for integers), float (for floating-point numbers),
More informationKey Differences Between Python and Java
Python Python supports many (but not all) aspects of object-oriented programming; but it is possible to write a Python program without making any use of OO concepts. Python is designed to be used interpretively.
More informationPython a modern scripting PL. Python
Python a modern scripting PL Basic statements Basic data types & their operations Strings, lists, tuples, dictionaries, files Functions Strings Dictionaries Many examples originally from O Reilly Learning
More informationIntroduction to: Computers & Programming: Review prior to 1 st Midterm
Introduction to: Computers & Programming: Review prior to 1 st Midterm Adam Meyers New York University Summary Some Procedural Matters Summary of what you need to Know For the Test and To Go Further in
More informationVisualize ComplexCities
Introduction to Python Chair of Information Architecture ETH Zürich February 22, 2013 First Steps Python Basics Conditionals Statements Loops User Input Functions Programming? Programming is the interaction
More informationSTEAM Clown & Productions Copyright 2017 STEAM Clown. Page 1
What to add next time you are updating these slides Update slides to have more animation in the bullet lists Verify that each slide has stand alone speaker notes Page 1 Python 3 Running The Python Interpreter
More informationData Structures. Lists, Tuples, Sets, Dictionaries
Data Structures Lists, Tuples, Sets, Dictionaries Collections Programs work with simple values: integers, floats, booleans, strings Often, however, we need to work with collections of values (customers,
More informationPython - Variable Types. John R. Woodward
Python - Variable Types John R. Woodward Variables 1. Variables are nothing but named reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationPRG PROGRAMMING ESSENTIALS. Lecture 2 Program flow, Conditionals, Loops
PRG PROGRAMMING ESSENTIALS 1 Lecture 2 Program flow, Conditionals, Loops https://cw.fel.cvut.cz/wiki/courses/be5b33prg/start Michal Reinštein Czech Technical University in Prague, Faculty of Electrical
More informationIntroduction to Python
Introduction to Python www.python.org MPBA Fondazione Bruno Kessler Trento Italy Roberto Visintainer visintainer@fbk.eu 1 Intro Python is an open source scripting language. Developed by Guido van Rossum
More informationLoops and Conditionals. HORT Lecture 11 Instructor: Kranthi Varala
Loops and Conditionals HORT 59000 Lecture 11 Instructor: Kranthi Varala Relational Operators These operators compare the value of two expressions and returns a Boolean value. Beware of comparing across
More information