Programming environments. Introduction to Python. Adrian Copie, Ph.D.
|
|
- Gabriella Lizbeth Matthews
- 6 years ago
- Views:
Transcription
1 Programming environments Introduction to Python Adrian Copie, Ph.D.! UVT: room 050B 1
2 2
3 Bibliography 3 Mark Lutz - Learning Python (O Reilly) Leaning Python the Hard Way (free book) Documentation on python.org official website Any other resource on internet (there are plenty!)
4 Lecture. Table of contents. (1/2) 4 Lecture Content Lecture 1 Lecture 2 Lecture 3 Introduction to Python programming language. Advantages and disadvantages. Data types: numeric, boolean, string, lists, sets, tuples while and for loops. The name and value binding mechanism. Passing parameters to functions. Lecture 4 Lecture 5 Lecture 6 Dictionary data type. Lists and dictionaries comprehension. Files and methods of files processing. Objects comparison. Significance of True and False in Python programming language. Modules a packages in Python. Organizing programs. OOP in Python. Introduction to classes, attributes and specific methods.constructors and inheritance.
5 Lecture. Table of contents. (2/2) 5 Lecture Content Lecture 7 Lecture 8 Lecture 9 Lecture 10 Lecture 11 Lecture 12 Lecture 13 eval() function in Python and its importance. More about object creation, inheritance, composition, delegation nd other specific elements in OOP. Elements of functional programming using Python. Lambda functions, closures and decorators. Using standard exceptions in Python. Creating custom exceptions. Processes and threads in Python. Synchronization between threads. Queues. Design patterns based on Python programming language: singleton, proxy, facade, factory, adapter. Data serialization in Python, using pickle, json and databases. Elements of networking programming based on sockets and usage of urllib library. Introduction to Python s Django framework.
6 Laboratories 6 Basically we ll touch and deepen the notions and concepts discussed during the lectures.! We ll set some homework and we ll discuss it during the laboratories. We ll use Python 3.x As a recommended IDE, use PyCharm Community Edition from JetBrains (it is free)
7 Really? 7
8 Creator of Python 8
9 Python name comes from the Monty Python comedy group 9
10 Why Python? 10
11 Python Strengths Why Python? 11
12 Python Strengths Quality of the Software Why Python? 12
13 Python Strengths Quality of the Software Development Productivity Why Python? 13
14 Python Strengths Quality of the Software Development Productivity Why Python? Portability of the programs 14
15 Python Strengths Quality of the Software Development Productivity Why Python? Portability of the programs Support libraries 15
16 Python Strengths Quality of the Software Development Productivity Why Python? Component Integration Portability of the programs Support libraries 16
17 Python Strengths Quality of the Software Enjoyment Development Productivity Why Python? Component Integration Portability of the programs Support libraries 17
18 Python strengths 18
19 Python Strengths Python 19
20 Python Strengths OO Python 20
21 Python Strengths OO Free Python 21
22 Python Strengths OO Free Python Portable 22
23 Python Strengths a = 'alfa' print(type(a)) a = [1, 2] print(type(a)) OO output:! <class 'str'> <class 'list'> Python Free Portable Dynamically typed Automatic memory management Programming-in-the-large support Built-in object types Built-in tools Library utilities Third party utilities Powerful 23
24 Python Strengths OO Free Python Portable Mixable Powerful 24
25 Python Strengths OO Free Easy to use Python Portable Mixable Powerful 25
26 Python Strengths OO Easy to learn Free Easy to use Python Portable Mixable Powerful 26
27 Python Strengths 27
28 Python Downsize Being an interpreted language, is a little bit slower than C/C++ If the execution speed is the priority, use C/C++ 28
29 Python flavours 29
30 Python flavours 30 CPython Reference implementation Written in C Highest level of compatibility with Python packages and C extenstion modules PyPy Implementation in RPython (Restricted Python) Supports multiple back-ends (C, CLI, JVM) Better performance than CPython (over 5 times faster) Jython Compiles Python to Java bytecode which is eventually executed on a JVM Useful when an interface with existing Java codebase is needed IronPython Python implementation for.net framework Can be integrated directly in Visual Studio, using Python Tools for VS
31 Python In real life, usually the speed of development prevails over the speed of execution 31
32 What we can I do with Python? (I) 32
33 What can I do with Python? (II) 33 system programming (shell tools) GUIs (tkinter) internet scripting component integration database programming rapid prototyping numeric and scientific programming games image processing robots many more
34 Python vs. Java 34
35 Comparison Java vs. Python (I) 35 Java Python public class Main { public static void main(string[] args) { System.out.println(" hello world"); } } print "hello world"; public static void main(string[] args) { String test = "compare Java with Python"; for(string a : test.split(" ")) a="compare Python with Java"; print a.split(); System.out.print(a);
36 Comparison Java vs. Python (II) Java class Animal{ private String name; public Animal(String name){ this.name = name; } public void saysomething(){ System.out.println("I am " + name); } } class Dog extends Animal{ public Dog(String name) { super(name); } public void saysomething(){ System.out.println("I can bark"); } } public class Main { public static void main(string[] args) { Dog dog = new Dog("Chihuahua"); dog.saysomething(); class Animal(): Python def init (self, name): self.name = name def saysomething(self): print "I am " + self.name class Dog(Animal): def saysomething(self): print "I am "+ self.name \ + ", and I can bark" dog = Dog("Chihuahua") dog.saysomething() } } 36
37 Comparison Java vs. Python (III) Java File dir = new File(".");// get current directory File fin = new File(dir.getCanonicalPath() + File.separator + "example.txt"); FileInputStream fis = new FileInputStream(fin); // //Construct the BufferedReader object BufferedReader in = new BufferedReader(new InputStreamReader(fis)); String aline = null; while ((aline = in.readline())!= null) { // //Process each line, here we count empty lines if (aline.trim().length() == 0) { } } // do not forget to close the buffer reader in.close(); Python myfile = open("/home/student/programs/example.txt") print myfile.read(); 37
38 Coding Style! It is important to follow consistency and obey a coding style PEP (Python Enhancement Proposal) PEP8 38
39 Python does not have code blocks 39
40 Python Philosophy Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! 40
41 Python Interpreter (Image from 41
42 Python shell 42
43 Python IDE (PyCharm) 43
44 Structure of Python programs Python Program Module 1 Module 2 Module 3 Module n Python Module Statement 1 Statement 2 Statement 3 Statement n Python Statement Expression 1 Expression 2 Expression 3 Expression n Python Expression Object 1 Object 2 Object 3 Object n 44
45 Python built-in objects 45 Object type Example Numbers Strings 123, , Decimal abc, spam, b x\01c Lists [1, [2, three ], 4] Dictionaries { language : python, version : 3 } Tuples (1, two, 3, IV ) Files f = open( python, r ) Sets set( abc ), { a, b, c } Other Boolean, None
46 46 Numbers Integers (123, 99) Floating point (1.23, 0.99) Complex (1j, 1+2j) Fixed precision decimals Rational fractions (Fraction(2,3))
47 47 Number operators Operator Operation + addition * multiplication - subtraction / division ** exponentiation % modulus // floor division
48 Booleans 48 Booleans - represents the truth value of an expression In Python: {True, False} Operations: not, and, or x y not x not y x and y x or y True! False! False! False! True! True! True! False! False! True! False! True! False! True! True! False! False! True! False! False! True! True! False! False!
49 Strings 49
50 Strings - Definitions 50 Strings: Record textual information Record arbitrary collection of bytes Represent a so called sequence Sequences: positionally ordered collection of other objects maintain a left-to-right order among the items they contain: their items are stored and fetched by their relative position
51 51 Sequences - Operations (I) Length of a string >>>s = python >>>len(s) 6 Indexing sequences >>>s[0] p >>>s[-1] n >>>s[-2] o
52 52 Sequences - Operations (II) Slicing >>>s[1:3] yt! >>>s[1:] ython! >>>s[:3] pyt! >>>s[:] python
53 53 Sequences - Operations (III) Concatenation >>> monty + s monty python Repetition >>>s * 3 pythonpythonpython
54 Strings - Immutability 54 Strings are immutable. Every string operation produces a new string. >>> s= python'! >>> s[0] p'! >>> s[0]='b' Traceback (most recent call last): File "<input>", line 1, in <module> TypeError: 'str' object does not support item assignment
55 Strings are immutable 55 s = 'alfa' print(id(s)) s = 'beta' print(id(s)) output:! One can notice that after reassigning of a new value, the s object is recreated, receiving a new id
56 56 Strings - Some useful methods find >>> s.find('on') 4 replace >>> s.replace('p', 'j') 'jython' split >>> s='cython,jython,python' >>> s.split(',') ['cython', 'jython', 'python']
57 Strings - Getting help (I) 57 >>>dir(s)! [' add ', ' class ', ' contains ', ' delattr ', ' dir ', ' doc ', ' eq ', ' format ', ' ge ', ' getattribute ', ' getitem ', ' getnewargs ', ' gt ', ' hash ', ' init ', ' iter ', ' le ', ' len ', ' lt ', ' mod ', ' mul ', ' ne ', ' new ', ' reduce ', ' reduce_ex ', ' repr ', ' rmod ', ' rmul ', ' setattr ', ' sizeof ', ' str ', ' subclasshook ', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
58 Strings - Getting help (II) 58 >>> help(s.format)! Help on built-in function format:! format(...) method of builtins.str instance S.format(*args, **kwargs) -> str Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces ('{' and '}').
59 Conclusions Strengths: OO, Free, Portable, Powerful, Mixable, Easy to Use, Easy to Learn Weaknesses: A little bit slower than other compiled languages Interpreted language Use: for a wide area of projects, general purpose language 59
60 End of Lecture 1 60
Python 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 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 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 informationIntroductory Linux Course. Python I. Nina Fischer Dept. for Cell and Molecular Biology, Uppsala University
Introductory Linux Course Python I Nina Fischer Dept. for Cell and Molecular Biology, Uppsala University nina.fischer@icm.uu.se August 26, 2016 Outline q Python introducjon q Python basics get started
More informationIntroductory Linux Course. Python I. Nina Fischer Dept. for Cell and Molecular Biology, Uppsala University
Introductory Linux Course Python I Nina Fischer Dept. for Cell and Molecular Biology, Uppsala University nina.fischer@icm.uu.se January 12, 2017 Outline q Python introducjon q Python basics get started
More informationIPSL python tutorial: some exercises for beginners
1 of 9 10/22/2013 03:55 PM IPSL python tutorial: some exercises for beginners WARNING! WARNING! This is the FULL version of the tutorial (including the solutions) WARNING! Jean-Yves Peterschmitt - LSCE
More informationPython Objects. Charles Severance. Python for Everybody
Python Objects Charles Severance Python for Everybody www.py4e.com Warning This lecture is very much about definitions and mechanics for objects This lecture is a lot more about how it works and less about
More information(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in.
Basics of Python by Kaustubh Vaghmare (IUCAA, Pune) E-mail: kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 13 February 2014 11:59 AM Topics to be Covered (Not in any specific order.) Basic I/O in
More informationStrings. Looping. dna = 'ATGTAGC' print(dna) In [1]: ATGTAGC. You can loop over the characters of a string using a for loop, as we saw on Tuesday:
Strings A string is simply a sequence of characters. From a biological perspective, this is quite useful, as a DNA sequence is simply a string composed of only 4 letters, and thus easily manipulated in
More informationHandling Strings and Bytes
Chapter 9 Handling Strings and Bytes In this chapter, we present some of the most used methods in strings and bytes objects. Strings are extremely useful to manage most of the output generated from programs,
More informationPython - 2. Jim Eng
Python - 2 Jim Eng jimeng@umich.edu Lists Dictionaries Try... except Methods and Functions Classes and Objects Midterm Review Overview Patterns in programming - 1 Sequential steps Conditional steps Repeated
More information(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 16 October :50 PM
Basics of Python by Kaustubh Vaghmare (IUCAA, Pune) E-mail: kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 16 October 2014 03:50 PM Topics to be Covered (Not in any specific order.) Basic I/O in Python
More informationOOP and Scripting in Python
DIEE - Università degli Studi di Cagliari OOP and Scripting in Python Introduction Giuliano Armano DIEE Univ. di Cagliari Python Roots... Object Oriented Programming (C++, Modula-3, ABC, Icon) Scripting
More informationLECTURE 1. Getting Started with Python
LECTURE 1 Getting Started with Python ABOUT PYTHON Development started in the 1980 s by Guido van Rossum. Only became popular in the last decade or so. Python 2.x currently dominates, but Python 3.x is
More informationStrings. Chapter 6. Python for Everybody
Strings Chapter 6 Python for Everybody www.py4e.com String Data Type A string is a sequence of characters A string literal uses quotes 'Hello' or "Hello" For strings, + means concatenate When a string
More informationCOMP 364: Classes, Objects, and Names
COMP 364: Classes, Objects, and Names Carlos G. Oliver, Christopher Cameron September 13, 2017 1/26 Outline 1. 202 vs 364 2. Development Environment Recap 3. Basic Data Types 4. Variables 2/26 Your Development
More informationSI Networked Computing: Storage, Communication, and Processing, Winter 2009
University of Michigan Deep Blue deepblue.lib.umich.edu 2009-01 SI 502 - Networked Computing: Storage, Communication, and Processing, Winter 2009 Severance, Charles Severance, C. (2008, December 19). Networked
More informationIntroduction to Python for Plone developers
Plone Conference, October 15, 2003 Introduction to Python for Plone developers Jim Roepcke Tyrell Software Corporation What we will learn Python language basics Where you can use Python in Plone Examples
More information1 Decorators. 2 Descriptors. 3 Static Variables. 4 Anonymous Classes. Sandeep Sadanandan (TU, Munich) Python For Fine Programmers July 13, / 19
1 Decorators 2 Descriptors 3 Static Variables 4 Anonymous Classes Sandeep Sadanandan (TU, Munich) Python For Fine Programmers July 13, 2009 1 / 19 Decorator Pattern In object-oriented programming, the
More informationCS61A Lecture 15 Object Oriented Programming, Mutable Data Structures. Jom Magrotker UC Berkeley EECS July 12, 2012
CS61A Lecture 15 Object Oriented Programming, Mutable Data Structures Jom Magrotker UC Berkeley EECS July 12, 2012 COMPUTER SCIENCE IN THE NEWS http://www.iospress.nl/ios_news/music to my eyes device converting
More informationDuration: Six Weeks Faculty : Mr Sai Kumar, Having 10+ Yrs Experience in IT
Duration: Six Weeks Faculty : Mr Sai Kumar, Having 10+ Yrs Experience in IT Online Classes are also available Recorded class will be given if you miss any day interview tips and quiz at end of every module
More informationPython Programming. Lecture 1. January 25 th. University of Pennsylvania 2010, Adam Aviv CIS 192 Spring
Python Programming Lecture 1 January 25 th 2010, Adam Aviv CIS 192 Spring 2010 1 Welcome Where are you? Levine 100, Wu & Chen Auditorium 2/8 we will be in Heilmeir Hall (Towne 100) Who am I? Adam Aviv,
More informationAssignment 1: Getting Started with Python
Assignment 1: Getting Started with Python This tutorial will cover the basics of working in the Unix environment for the USC aludra.usc.edu machines and a small Python tutorial. It assumes you already
More informationCOLLEGE OF ENGINEERING, NASHIK-4
Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4 DEPARTMENT OF COMPUTER ENGINEERING Important PYTHON Questions 1. What is Python? Python is a high-level, interpreted, interactive and object-oriented
More informationSD314 Outils pour le Big Data
Institut Supérieur de l Aéronautique et de l Espace SD314 Outils pour le Big Data Functional programming in Python Christophe Garion DISC ISAE Christophe Garion SD314 Outils pour le Big Data 1/ 35 License
More informationPrinceton University COS 333: Advanced Programming Techniques A Subset of Python 2.7
Princeton University COS 333: Advanced Programming Techniques A Subset of Python 2.7 Program Structure # Print "hello world" to stdout. print 'hello, world' # Print "hello world" to stdout. def f(): print
More informationPart IV. More on Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,
Part IV More on Python Compact Course @ Max-Planck, February 16-26, 2015 36 More on Strings Special string methods (excerpt) s = " Frodo and Sam and Bilbo " s. islower () s. isupper () s. startswith ("
More informationLearning R via Python...or the other way around
Learning R via Python...or the other way around Dept. of Politics - NYU January 7, 2010 What We ll Cover Brief review of Python The Zen of Python How are R and Python the same, and how are they different
More informationPYTHON CONTENT NOTE: Almost every task is explained with an example
PYTHON CONTENT NOTE: Almost every task is explained with an example Introduction: 1. What is a script and program? 2. Difference between scripting and programming languages? 3. What is Python? 4. Characteristics
More information6. Object-Oriented Programming, II. Programming and Algorithms II Degree in Bioinformatics Fall 2018
6. Object-Oriented Programming, II Programming and Algorithms II Degree in Bioinformatics Fall 2018 Inheritance class Carnivora(Animal): class Canid(Carnivora): class Dog(Canid): class Husky(Dog): class
More informationIntroduction to Python. Didzis Gosko
Introduction to Python Didzis Gosko Scripting language From Wikipedia: A scripting language or script language is a programming language that supports scripts, programs written for a special run-time environment
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
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 informationCSC 221: Introduction to Programming. Fall 2013
CSC 221: Introduction to Programming Fall 2013 Python data, assignments & turtles Scratch programming review Python & IDLE numbers & expressions variables & assignments strings & concatenation input &
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 informationBabu Madhav Institute of Information Technology, UTU 2015
Five years Integrated M.Sc.(IT)(Semester 5) Question Bank 060010502:Programming in Python Unit-1:Introduction To Python Q-1 Answer the following Questions in short. 1. Which operator is used for slicing?
More informationIntro to Python. by Daniel Greenfeld
Intro to Python by Daniel Greenfeld Intro to Python a.k.a. 20 cool things you can do with Python Tons of content Please hold your questions until the end Latest slides will be made available Special thanks
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 informationPYTHON TRAINING COURSE CONTENT
SECTION 1: INTRODUCTION What s python? Why do people use python? Some quotable quotes A python history lesson Advocacy news What s python good for? What s python not good for? The compulsory features list
More informationStrings. Upsorn Praphamontripong. Note: for reference when we practice loop. We ll discuss Strings in detail after Spring break
Note: for reference when we practice loop. We ll discuss Strings in detail after Spring break Strings Upsorn Praphamontripong CS 1111 Introduction to Programming Spring 2018 Strings Sequence of characters
More informationModule 3: Strings and Input/Output
Module 3: Strings and Input/Output Topics: Strings and their methods Printing to standard output Reading from standard input Readings: ThinkP 8, 10 1 Strings in Python: combining strings in interesting
More informationProgramming with Python
Programming with Python Lecture 3: Python Functions IPEC Winter School 2015 B-IT Dr. Tiansi Dong & Dr. Joachim Köhler Python Functions arguments return obj Global vars Files/streams Function Global vars
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 informationUNIT-III. All expressions involving relational and logical operators will evaluate to either true or false
UNIT-III BOOLEAN VALUES AND OPERATORS: A boolean expression is an expression that is either true or false. The following examples use the operator ==, which compares two operands and produces if they are
More information(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in.
Basics of Python - 2 by Kaustubh Vaghmare (IUCAA, Pune) E-mail: kaustubh[at]iucaa[dot]ernet[dot]in 1 of 54 Sunday 16 February 2014 05:30 PM Our First Program - Rewritten! Let us introduce the following
More informationCourse Introduction and Python Basics
Course Introduction and Python Basics Johan Falkenjack 2018-01-15 Course Introduction Python > Data Science 3 hp pass/fail 3 lectures, 3 labs (2 sessions for each lab) Python Basics Programming Paradigms
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques () Lecture 20 February 28, 2018 Transition to Java Announcements HW05: GUI programming Due: THURSDAY!! at 11:59:59pm Lots of TA office hours today Thursday See Piazza
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationWebgurukul Programming Language Course
Webgurukul Programming Language Course Take One step towards IT profession with us Python Syllabus Python Training Overview > What are the Python Course Pre-requisites > Objectives of the Course > Who
More informationIntroduction to Python
Introduction to Python Version 1.1.5 (12/29/2008) [CG] Page 1 of 243 Introduction...6 About Python...7 The Python Interpreter...9 Exercises...11 Python Compilation...12 Python Scripts in Linux/Unix & Windows...14
More informationString Processing CS 1111 Introduction to Programming Fall 2018
String Processing CS 1111 Introduction to Programming Fall 2018 [The Coder s Apprentice, 10] 1 Collections Ordered, Dup allow List Range String Tuple Unordered, No Dup Dict collection[index] Access an
More informationInverse Ray Shooting Tutorial. Jorge Jiménez Vicente Dpto. Física Teórica y del Cosmos Universidad de Granada Spain
Inverse Ray Shooting Tutorial Jorge Jiménez Vicente Dpto. Física Teórica y del Cosmos Universidad de Granada Spain Final goal Session I Introduction to Python Solving the lens equation Ray shooting basics
More informationPython INTRODUCTION: Understanding the Open source Installation of python in Linux/windows. Understanding Interpreters * ipython.
INTRODUCTION: Understanding the Open source Installation of python in Linux/windows. Understanding Interpreters * ipython * bpython Getting started with. Setting up the IDE and various IDEs. Setting up
More informationInterpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled
Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac
More informationLecture #15: Generic Functions and Expressivity. Last modified: Wed Mar 1 15:51: CS61A: Lecture #16 1
Lecture #15: Generic Functions and Expressivity Last modified: Wed Mar 1 15:51:48 2017 CS61A: Lecture #16 1 Consider the function find: Generic Programming def find(l, x, k): """Return the index in L of
More informationECE 364 Software Engineering Tools Laboratory. Lecture 7 Python: Object Oriented Programming
ECE 364 Software Engineering Tools Laboratory Lecture 7 Python: Object Oriented Programming 1 Lecture Summary Object Oriented Programming Concepts Object Oriented Programming in Python 2 Object Oriented
More informationCoding Styles for Python
Wintersemester 2007/2008 1 The Zen of Python 2 Style Guide for Python Code 3 Whitespace in Expressions and Statements 4 Naming Conventions 5 References The Zen of Python Python 2.4.2 (#2, Sep 30 2005,
More informationWorking with Sequences: Section 8.1 and 8.2. Bonita Sharif
Chapter 8 Working with Sequences: Strings and Lists Section 8.1 and 8.2 Bonita Sharif 1 Sequences A sequence is an object that consists of multiple data items These items are stored consecutively Examples
More informationCourse Structure of Python Training: UNIT - 1: COMPUTER FUNDAMENTALS. Computer Fundamentals. Installation of Development Tools:
Course Structure of Python Training: UNIT - 1: COMPUTER FUNDAMENTALS Computer Fundamentals o What is a Computer? o Computation vs calculation Microprocessors and Memory Concepts o Discussion on register,
More informationEssentials for Scientific Computing: Introduction to Python Day 11 & 12
Essentials for Scientific Computing: Introduction to Python Day 11 & 12 Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Conditionals 1.1 if Construct In python blocks of code are created by indentation. That
More informationFundamentals of Programming (Python) Object-Oriented Programming. Ali Taheri Sharif University of Technology Spring 2018
Fundamentals of Programming (Python) Object-Oriented Programming Ali Taheri Sharif University of Technology Outline 1. Python Data Types 2. Classes and Objects 3. Defining Classes 4. Working with Objects
More informationpython. a presentation to the Rice University CS Club November 30, 2006 Daniel Sandler
python. a presentation to the Rice University CS Club November 30, 2006 Daniel Sandler http://www.cs.rice.edu/~dsandler/python/ 1. 2. 3. 4. 1. A young mind is corrupted. Me, circa 2000 (very busy) Many
More information[CHAPTER] 1 INTRODUCTION 1
FM_TOC C7817 47493 1/28/11 9:29 AM Page iii Table of Contents [CHAPTER] 1 INTRODUCTION 1 1.1 Two Fundamental Ideas of Computer Science: Algorithms and Information Processing...2 1.1.1 Algorithms...2 1.1.2
More information1 Four reasons for learning python 3. 2 Installing Python 4
Contents 1 Four reasons for learning python 3 2 Installing Python 4 3 Language basics 7 3.1 Built-in types........................................ 7 3.2 Useful built-in functions..................................
More informationPython Training. Complete Practical & Real-time Trainings. A Unit of SequelGate Innovative Technologies Pvt. Ltd.
Python Training Complete Practical & Real-time Trainings A Unit of. ISO Certified Training Institute Microsoft Certified Partner Training Highlights : Complete Practical and Real-time Scenarios Session
More informationIntroduction to Python: Data types. HORT Lecture 8 Instructor: Kranthi Varala
Introduction to Python: Data types HORT 59000 Lecture 8 Instructor: Kranthi Varala Why Python? Readability and ease-of-maintenance Python focuses on well-structured easy to read code Easier to understand
More informationPython Crash-Course. C. Basso. Dipartimento di Informatica e Scienze dell Informazione Università di Genova. December 11, 2007
Python Crash-Course C. Basso Dipartimento di Informatica e Scienze dell Informazione Università di Genova December 11, 2007 Basso (DISI) Python Crash-Course December 11, 2007 1 / 26 What is Python? Python
More informationFunctions #5. Serdar ARITAN. Department of Computer Graphics Hacettepe University, Ankara, Turkey
#5 Serdar ARITAN Department of Computer Graphics Hacettepe University, Ankara, Turkey 1 I have never considered Python to be heavily influenced by functional languages, no matter what people say or think.
More informationCSE 142 Su 04 Computer Programming 1 - Java. Objects
Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request
More information18.1. CS 102 Unit 18. Python. Mark Redekopp
18.1 CS 102 Unit 18 Python Mark Redekopp 18.2 Credits Many of the examples below are taken from the online Python tutorial at: http://docs.python.org/tutorial/introduction.html 18.3 Python in Context Two
More informationPython: Short Overview and Recap
Python: Short Overview and Recap Benjamin Roth CIS LMU Benjamin Roth (CIS LMU) Python: Short Overview and Recap 1 / 39 Data Types Object type Example creation Numbers (int, float) 123, 3.14 Strings this
More informationTable of Contents. Preface... xxi
Table of Contents Preface... xxi Chapter 1: Introduction to Python... 1 Python... 2 Features of Python... 3 Execution of a Python Program... 7 Viewing the Byte Code... 9 Flavors of Python... 10 Python
More informationSoftware Development Python (Part B)
Software Development Python (Part B) Davide Balzarotti Eurecom 1 List Comprehension It is a short way to construct a list based on the content of other existing lists Efficient Elegant Concise List comprehensions
More informationPositional, keyword and default arguments
O More on Python n O Functions n Positional, keyword and default arguments in repl: >>> def func(fst, snd, default="best!"):... print(fst, snd, default)... >>> func(snd='is', fst='python') ('Python', 'is',
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 informationLecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University
Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling
More informationPYTHON FOR MEDICAL PHYSICISTS. Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital
PYTHON FOR MEDICAL PHYSICISTS Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital TUTORIAL 1: INTRODUCTION Thursday 1 st October, 2015 AGENDA 1. Reference list 2.
More informationWhat is a class? Responding to messages. Short answer 7/19/2017. Code Listing 11.1 First Class. chapter 11. Introduction to Classes
chapter 11 Code Listing 11.1 First Class Introduction to Classes What is a class? If you have done anything in computer science before, you likely will have heard the term object oriented programming (OOP)
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 informationAbout Python. Python Duration. Training Objectives. Training Pre - Requisites & Who Should Learn Python
About Python Python course is a great introduction to both fundamental programming concepts and the Python programming language. By the end, you'll be familiar with Python syntax and you'll be able to
More informationLab 5: Function Types, Lists and Dictionaries, Sorting. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 5: Function Types, Lists and Dictionaries, Sorting Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Assignment review Pig Latin Tokenization function Two types of function: returning
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 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 informationPython Basics. Nakul Gopalan With help from Cam Allen-Lloyd
Python Basics Nakul Gopalan ngopalan@cs.brown.edu With help from Cam Allen-Lloyd 1 Introduction to the idea Readable, easy to learn programming language. Created by Guido van Rossum Named after the BBC
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 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 informationZero Buffer Documentation
Zero Buffer Documentation Release Alex Gaynor and David Reid March 02, 2017 Contents 1 Installation 3 2 Contents 5 2.1 API Reference.............................................. 5 i ii Zero Buffer Documentation,
More informationCS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University
CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions
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 informationIAP Python - Lecture 2
IAP Python - Lecture 2 Evan Broder, Andrew Farrell MIT SIPB January 6, 2011 Higher Order Functions A function is a first-class object, so it can be returned from a function. def maketunk(n): def thunk():
More informationIntroduction to programming with Python
Introduction to programming with Python Ing. Lelio Campanile 1/61 Main Goal - Introduce you to programming - introduce you to the most essential feature of python programming 2/61 Before to start The name
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 informationAlgorithms and Programming I. Lecture#12 Spring 2015
Algorithms and Programming I Lecture#12 Spring 2015 Think Python How to Think Like a Computer Scientist By :Allen Downey Installing Python Follow the instructions on installing Python and IDLE on your
More informationAccelerating Information Technology Innovation
Accelerating Information Technology Innovation http://aiti.mit.edu/program/philippines-summer-2012/ Philippines Summer 2012 Lecture 1 Introduction to Python June 19, 2012 Agenda About the Course What is
More informationChapter 8: More About Strings. COSC 1436, Summer 2018 Dr. Zhang 7/10/2018
Chapter 8: More About Strings COSC 1436, Summer 2018 Dr. Zhang 7/10/2018 Creating Strings The str Class s1 = str() # Create an empty string s2 = str("welcome") # Create a string Welcome Python provides
More informationA polyglot day: learning from language paradigms. Benson Joeris Kathleen Dollard
A polyglot day: learning from language paradigms Benson Joeris Kathleen Dollard What if you understood all the paradigms that define modern languages? You could program better in your base language, choose
More informationBasic Concepts. Computer Science. Programming history Algorithms Pseudo code. Computer - Science Andrew Case 2
Basic Concepts Computer Science Computer - Science - Programming history Algorithms Pseudo code 2013 Andrew Case 2 Basic Concepts Computer Science Computer a machine for performing calculations Science
More informationPython Basics. Lecture and Lab 5 Day Course. Python Basics
Python Basics Lecture and Lab 5 Day Course Course Overview Python, is an interpreted, object-oriented, high-level language that can get work done in a hurry. A tool that can improve all professionals ability
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 informationLecture #16: Generic Functions and Expressivity. Last modified: Fri Feb 26 19:16: CS61A: Lecture #16 1
Lecture #16: Generic Functions and Expressivity Last modified: Fri Feb 26 19:16:38 2016 CS61A: Lecture #16 1 Consider the function find: Generic Programming def find(l, x, k): """Return the index in L
More informationStrings are actually 'objects' Strings
Strings are actually 'objects' Strings What is an object?! An object is a concept that we can encapsulate data along with the functions that might need to access or manipulate that data. What is an object?!
More information