Python is a great programming language. It is a complete tutorial of using this programming language.
This slides is split into two parts, and it is the second part. Another part is at: http://www.slideshare.net/moskytw/programming-with-python-basic.
Learn python in easy steps. This presentation will cover followings
1. Python basics
2. How to write a python code
3. Variable usage & their syntax
4. Strings handling
5. Files handling
6. How to use loops and others.
7. Python Vs C language.
This document provides an introduction and overview of the Python programming language. It covers Python's history and key features such as being object-oriented, dynamically typed, batteries included, and focusing on readability. It also discusses Python's syntax, types, operators, control flow, functions, classes, imports, error handling, documentation tools, and popular frameworks/IDEs. The document is intended to give readers a high-level understanding of Python.
( ** Python Certification Training: https://www.edureka.co/python ** )
This Edureka PPT on Advanced Python tutorial covers all the important aspects of using Python for advanced use-cases and purposes. It establishes all of the concepts like system programming , shell programming, pipes and forking to show how wide of a spectrum Python offers to the developers.
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This document contains slides from a Python workshop presentation. It introduces Python, discussing its history, philosophy, features, and how to write Python code. Some key points covered include:
- Python was created in the late 1980s and named after Monty Python.
- It aims to have clear, readable syntax while also being powerful.
- Python code tends to be more concise than languages like Java and C++.
- It uses indentation rather than braces to define code blocks.
- Common data types like lists, dictionaries, and tuples are covered.
- Basic programming constructs like conditionals, loops, functions and file I/O are demonstrated.
The document discusses an agenda for a Python workshop that will cover topics such as an introduction to Python, its features, how it is used in enterprises, installing Python on Windows and Linux, setting up development environments, and learning about Python concepts like strings, numbers, functions, modules, data structures, object-oriented programming, and errors/exceptions handling. The workshop will also include hands-on exercises and a quiz.
The speaker discussed the benefits of type hints in Python. Type hints allow specifying the expected types of function parameters and return values, improving code readability, enabling code completion in editors, and allowing static type checking tools to analyze the code for type errors. The speaker demonstrated how to write type hints according to PEP 484 and PEP 526 standards and how to retrieve type information. Tools like Mypy were presented for doing static type analysis to catch errors. Using type hints and type checkers in continuous integration was recommended to catch errors early when collaborating on projects. The speaker concluded by explaining how using type hints made it easier for their team to port code from Python 2 to Python 3.
Python Programming - XIII. GUI ProgrammingRanel Padon
The document discusses Tkinter, the Python GUI programming interface. Tkinter provides a wrapper for the Tk GUI toolkit. Tk was originally created for Tcl but has bindings for other languages like Python through Tkinter. Tkinter allows Python programs to create graphical user interfaces by providing classes and methods that interface with the Tk GUI toolkit. Some key Tkinter widgets discussed include Frame, Label, Button, Entry, Radiobutton and Checkbutton. Pros of Tkinter include brevity, cross-platform support, maturity and extensibility. Potential cons are that it relies on Tcl/Tk which some consider unnecessary and it may have a theoretical speed disadvantage due to the multiple layers of interpretation.
Python is an interpreted, object-oriented programming language created by Guido van Rossum in 1990. It has a clear, readable syntax and is designed to be highly extensible. Python code is often much shorter than equivalent code in other languages like C++ or Java due to features like indentation-based blocks and dynamic typing. It is used for web development, scientific computing, and more.
What is Python? An overview of Python for science.Nicholas Pringle
Python is a general purpose, high-level, free and open-source programming language that is readable and intuitive. It has strong scientific computing packages like NumPy, SciPy, and Matplotlib that allow it to be used for tasks like MATLAB. Python emphasizes code readability and reusability through standards like PEP8 and version control, making it well-suited for collaboration between individual, institutional, and developer users in its large, diverse community.
Writing Fast Code (JP) - PyCon JP 2015Younggun Kim
The document discusses optimizing Python code performance through profiling. It introduces various profiling tools like cProfile and line_profiler. As an example, it profiles a "fibonachicken" function that uses Fibonacci numbers to calculate the number of chickens needed to serve a given number of people. Profiling reveals the fib() and is_fibonacci() functions as bottlenecks. The document suggests improving fib() with Binet's formula and is_fibonacci() with Gessel's formula to avoid using fib() and gain better performance.
The document provides an overview of the Python programming language. It discusses that Python is an easy to learn, high-level, open-source programming language. It describes Python's design philosophy of code readability and how it allows programmers to express concepts in fewer lines of code compared to languages like C++ and Java. The document also discusses Python's powerful libraries, wide use across industries, and how to get started with Python programming using the IDLE integrated development environment.
Python Foundation – A programmer's introduction to Python concepts & styleKevlin Henney
This document provides an overview of a Python Foundation course that introduces Python concepts and programming style. The course covers Python history and culture, multi-paradigm programming in Python including procedural, modular, scripting, object-oriented and functional styles. It also covers Python syntax, logic and flow control, built-in data types, classes and objects. The course includes coding experiments, programming labs and homework assignments.
Python is a general purpose programming language created by Guido van Rossum in 1991. It is widely used by companies like Google, Facebook, and Dropbox for tasks like web development, data analysis, and machine learning. Python code is easy to read and write for beginners due to its simple syntax and readability. It supports features like object oriented programming, procedural programming, and functional programming.
The document provides an overview of the Python programming language. It discusses that Python is an interpreted, interactive, object-oriented language created by Guido van Rossum in the late 1980s. It describes Python as high-level, portable, and has an extensive standard library. The document then covers Python variables and data types, basic operators, and provides examples of Python code, including defining variables, strings, lists, tuples, and dictionaries.
Introduction to go language programming , benchmark with another language programming nodejs , php , ruby & python . how install go . use what IDE . and rapid learnin golang
This document provides an introduction and overview of the Python programming language. It discusses what Python is, why to learn a scripting language and why Python specifically. It covers how to install Python and how to edit Python code using IDLE. The rest of the document demonstrates various Python concepts like variables, data types, operators, flow control statements, functions and more through sample code examples. Each code example is accompanied by instructions to run the sample script in IDLE.
Python Programming Course Lecture by IoT Code Lab Training.
Discussed Topic:
Chapter 0: Python Overview
0. Python Introduction
1. What is Python?
2. Story of Python
3. Why Python
4. Use of Python
5. Python Download + Installation
6. How to Use? + Online Course Resource
1. Variable, Data Type, Expression
1. Create First Python Program File
2. First Program - Hello World
3. Comment
4. Variable + Data Type + Example
5. Variable Naming Convention
6. Practice 0.1
2. Input/ Output
1. Input/ Output (String)
1. A String Input & Output
2. Display A Message in Print & Input function
3. Check Data Type
4. Practice 0.2
2. Input/ Output (Number)
1. An Integer Number Input & Output + Check Data Type
2. Type Conversion
3. A Float Number Input & Output + Check Data Type
4. Built-in Function with Example
5. Practice 0.3
3. Formatted Input Output
This deck was used to conduct a hands-on workshop at Mumbai Tech Meetup. It covers an introduction to Go, core language features, Object Oriented features of Go, Concurrency, API Servers and more.
This document discusses programming languages, compilers vs interpreters, and introduces Python. It explains that a programming language communicates instructions to a machine and can be used to create programs. An interpreter reads and executes code directly, while a compiler converts source code into machine code. Python is an interpreted, object-oriented language that is easy to learn yet powerful. It can be used for web, enterprise, and other applications. The document also provides basic information on Python syntax and data types.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Introduction To Python' will help you establish a strong hold on all the fundamentals in the Python programming language. Below are the topics covered in this PPT:
Introduction To Python
Keywords And Identifiers
Variables And Data Types
Operators
Loops In Python
Functions
Classes And Objects
OOPS Concepts
File Handling
YouTube Video: https://youtu.be/uYjRzbP5aZs
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The document provides an introduction to Python programming by discussing statements and syntax. It covers assignment statements, expression statements, print operations, conditional statements like if/else, and loop statements like while and for. It explains how Python programs are composed of modules containing statements with expressions. Truth tests for conditionals and built-in functions like range, zip that can be used in loops are also overviewed.
(1) Python uses indentation rather than braces to indicate blocks of code for functions and control flow. All statements within a block must be indented the same amount.
(2) Python identifiers can consist of letters, numbers, and underscores but must start with a letter or underscore. Identifiers are case-sensitive.
(3) There are reserved words in Python that cannot be used as identifiers such as def, if, else, and, or, not, etc.
Python offers several tool and public services that simplify starting and maintaining an open source project. This presentation show cases some of the most helpful one and explains the process, beginning with an empty folder and finishing with a published PyPI package.
This document provides an introduction to programming in Go. It discusses the origins and intentions of the Go language, where it is commonly used today, and what Go is and isn't. Go was created to be a systems programming language with better productivity than C++. It has seen widespread adoption beyond its original use cases. While Go isn't a functional or object-oriented language, it is compiled, statically typed, memory managed, concurrent, and ideal for building cloud infrastructure. The document also covers Go syntax including variables, types, loops, conditionals, functions, and more.
The document provides an introduction and overview of the Python programming language. It discusses that Python is an interpreted, object-oriented, high-level programming language that is easy to learn and read. It also covers Python features such as portability, extensive standard libraries, and support for functional, structured, and object-oriented programming. The document then discusses Python data types including numbers, strings, and various Python syntax elements before concluding with the history and evolution of the Python language through various versions.
It is the slides for SITCON[1] 2013 Workshop[2]: "Git - The Version Control System You Must Know".
[1]: http://sitcon.org/
[2]: http://www.openfoundry.org/tw/activities/details/415-the-open-source-way-coder
In your code base, to understand a random line, how many lines do you need to read back? Cloud you make it zero?
This talk will start with the impact of the maintainability, define the maintainability as “to understand a random line, the lines you need to read back”, show the practicing techniques to make it zero, or nearly zero, and finally, reach the goal: boost the maintainability.
It's the revision of “Beyond the Style Guides” [1] and the talk at PyCon TW 2016 [2], PyCon APAC/KR 2016 [3], and GDG DevFest Taipei 2016 [4].
[1]: https://speakerdeck.com/mosky/beyond-the-style-guides
[2]: https://tw.pycon.org/2016
[3]: https://www.pycon.kr/2016apac/
[4]: https://devfest-taipei-3cbee.firebaseapp.com/
This document provides an overview of sockets programming in Python. It discusses:
1) The basic Python sockets modules (Socket and SocketServer) which provide low-level networking and simplified server development.
2) Examples of creating stream and datagram sockets, binding addresses, listening for connections, and accepting clients.
3) How the SocketServer module simplifies creating TCP servers with a basic "Hello World" example server.
It's a talk about how to write understandable code from understanding human brain at Taipei.py [1] and PyCon HK 2015 [2].
[1]: http://www.meetup.com/Taipei-py/events/222174472/
[2]: http://2015.pycon.hk/
Python is an interpreted, object-oriented programming language created by Guido van Rossum in 1990. It has a clear, readable syntax and is designed to be highly extensible. Python code is often much shorter than equivalent code in other languages like C++ or Java due to features like indentation-based blocks and dynamic typing. It is used for web development, scientific computing, and more.
What is Python? An overview of Python for science.Nicholas Pringle
Python is a general purpose, high-level, free and open-source programming language that is readable and intuitive. It has strong scientific computing packages like NumPy, SciPy, and Matplotlib that allow it to be used for tasks like MATLAB. Python emphasizes code readability and reusability through standards like PEP8 and version control, making it well-suited for collaboration between individual, institutional, and developer users in its large, diverse community.
Writing Fast Code (JP) - PyCon JP 2015Younggun Kim
The document discusses optimizing Python code performance through profiling. It introduces various profiling tools like cProfile and line_profiler. As an example, it profiles a "fibonachicken" function that uses Fibonacci numbers to calculate the number of chickens needed to serve a given number of people. Profiling reveals the fib() and is_fibonacci() functions as bottlenecks. The document suggests improving fib() with Binet's formula and is_fibonacci() with Gessel's formula to avoid using fib() and gain better performance.
The document provides an overview of the Python programming language. It discusses that Python is an easy to learn, high-level, open-source programming language. It describes Python's design philosophy of code readability and how it allows programmers to express concepts in fewer lines of code compared to languages like C++ and Java. The document also discusses Python's powerful libraries, wide use across industries, and how to get started with Python programming using the IDLE integrated development environment.
Python Foundation – A programmer's introduction to Python concepts & styleKevlin Henney
This document provides an overview of a Python Foundation course that introduces Python concepts and programming style. The course covers Python history and culture, multi-paradigm programming in Python including procedural, modular, scripting, object-oriented and functional styles. It also covers Python syntax, logic and flow control, built-in data types, classes and objects. The course includes coding experiments, programming labs and homework assignments.
Python is a general purpose programming language created by Guido van Rossum in 1991. It is widely used by companies like Google, Facebook, and Dropbox for tasks like web development, data analysis, and machine learning. Python code is easy to read and write for beginners due to its simple syntax and readability. It supports features like object oriented programming, procedural programming, and functional programming.
The document provides an overview of the Python programming language. It discusses that Python is an interpreted, interactive, object-oriented language created by Guido van Rossum in the late 1980s. It describes Python as high-level, portable, and has an extensive standard library. The document then covers Python variables and data types, basic operators, and provides examples of Python code, including defining variables, strings, lists, tuples, and dictionaries.
Introduction to go language programming , benchmark with another language programming nodejs , php , ruby & python . how install go . use what IDE . and rapid learnin golang
This document provides an introduction and overview of the Python programming language. It discusses what Python is, why to learn a scripting language and why Python specifically. It covers how to install Python and how to edit Python code using IDLE. The rest of the document demonstrates various Python concepts like variables, data types, operators, flow control statements, functions and more through sample code examples. Each code example is accompanied by instructions to run the sample script in IDLE.
Python Programming Course Lecture by IoT Code Lab Training.
Discussed Topic:
Chapter 0: Python Overview
0. Python Introduction
1. What is Python?
2. Story of Python
3. Why Python
4. Use of Python
5. Python Download + Installation
6. How to Use? + Online Course Resource
1. Variable, Data Type, Expression
1. Create First Python Program File
2. First Program - Hello World
3. Comment
4. Variable + Data Type + Example
5. Variable Naming Convention
6. Practice 0.1
2. Input/ Output
1. Input/ Output (String)
1. A String Input & Output
2. Display A Message in Print & Input function
3. Check Data Type
4. Practice 0.2
2. Input/ Output (Number)
1. An Integer Number Input & Output + Check Data Type
2. Type Conversion
3. A Float Number Input & Output + Check Data Type
4. Built-in Function with Example
5. Practice 0.3
3. Formatted Input Output
This deck was used to conduct a hands-on workshop at Mumbai Tech Meetup. It covers an introduction to Go, core language features, Object Oriented features of Go, Concurrency, API Servers and more.
This document discusses programming languages, compilers vs interpreters, and introduces Python. It explains that a programming language communicates instructions to a machine and can be used to create programs. An interpreter reads and executes code directly, while a compiler converts source code into machine code. Python is an interpreted, object-oriented language that is easy to learn yet powerful. It can be used for web, enterprise, and other applications. The document also provides basic information on Python syntax and data types.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Introduction To Python' will help you establish a strong hold on all the fundamentals in the Python programming language. Below are the topics covered in this PPT:
Introduction To Python
Keywords And Identifiers
Variables And Data Types
Operators
Loops In Python
Functions
Classes And Objects
OOPS Concepts
File Handling
YouTube Video: https://youtu.be/uYjRzbP5aZs
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The document provides an introduction to Python programming by discussing statements and syntax. It covers assignment statements, expression statements, print operations, conditional statements like if/else, and loop statements like while and for. It explains how Python programs are composed of modules containing statements with expressions. Truth tests for conditionals and built-in functions like range, zip that can be used in loops are also overviewed.
(1) Python uses indentation rather than braces to indicate blocks of code for functions and control flow. All statements within a block must be indented the same amount.
(2) Python identifiers can consist of letters, numbers, and underscores but must start with a letter or underscore. Identifiers are case-sensitive.
(3) There are reserved words in Python that cannot be used as identifiers such as def, if, else, and, or, not, etc.
Python offers several tool and public services that simplify starting and maintaining an open source project. This presentation show cases some of the most helpful one and explains the process, beginning with an empty folder and finishing with a published PyPI package.
This document provides an introduction to programming in Go. It discusses the origins and intentions of the Go language, where it is commonly used today, and what Go is and isn't. Go was created to be a systems programming language with better productivity than C++. It has seen widespread adoption beyond its original use cases. While Go isn't a functional or object-oriented language, it is compiled, statically typed, memory managed, concurrent, and ideal for building cloud infrastructure. The document also covers Go syntax including variables, types, loops, conditionals, functions, and more.
The document provides an introduction and overview of the Python programming language. It discusses that Python is an interpreted, object-oriented, high-level programming language that is easy to learn and read. It also covers Python features such as portability, extensive standard libraries, and support for functional, structured, and object-oriented programming. The document then discusses Python data types including numbers, strings, and various Python syntax elements before concluding with the history and evolution of the Python language through various versions.
It is the slides for SITCON[1] 2013 Workshop[2]: "Git - The Version Control System You Must Know".
[1]: http://sitcon.org/
[2]: http://www.openfoundry.org/tw/activities/details/415-the-open-source-way-coder
In your code base, to understand a random line, how many lines do you need to read back? Cloud you make it zero?
This talk will start with the impact of the maintainability, define the maintainability as “to understand a random line, the lines you need to read back”, show the practicing techniques to make it zero, or nearly zero, and finally, reach the goal: boost the maintainability.
It's the revision of “Beyond the Style Guides” [1] and the talk at PyCon TW 2016 [2], PyCon APAC/KR 2016 [3], and GDG DevFest Taipei 2016 [4].
[1]: https://speakerdeck.com/mosky/beyond-the-style-guides
[2]: https://tw.pycon.org/2016
[3]: https://www.pycon.kr/2016apac/
[4]: https://devfest-taipei-3cbee.firebaseapp.com/
This document provides an overview of sockets programming in Python. It discusses:
1) The basic Python sockets modules (Socket and SocketServer) which provide low-level networking and simplified server development.
2) Examples of creating stream and datagram sockets, binding addresses, listening for connections, and accepting clients.
3) How the SocketServer module simplifies creating TCP servers with a basic "Hello World" example server.
It's a talk about how to write understandable code from understanding human brain at Taipei.py [1] and PyCon HK 2015 [2].
[1]: http://www.meetup.com/Taipei-py/events/222174472/
[2]: http://2015.pycon.hk/
This document discusses using Python to connect to and interact with a PostgreSQL database. It covers:
- Popular Python database drivers for PostgreSQL, including Psycopg which is the most full-featured.
- The basics of connecting to a database, executing queries, and fetching results using the DB-API standard. This includes passing parameters, handling different data types, and error handling.
- Additional Psycopg features like server-side cursors, transaction handling, and custom connection factories to access columns by name rather than number.
In summary, it provides an overview of using Python with PostgreSQL for both basic and advanced database operations from the Python side.
It is the slides for COSCUP[1] 2013 Hands-on[2], "Learning Python from Data".
It aims for using examples to show the world of Python. Hope it will help you with learning Python.
[1] COSCUP: http://coscup.org/
[2] COSCUP Hands-on: http://registrano.com/events/coscup-2013-hands-on-mosky
This document discusses functional programming in Python. It begins by defining functional programming and some of its key concepts like immutable data, functions as first-class citizens, and recursion. It then shows how Python supports functional programming with features like first-class functions, lambda expressions, and built-in functions like map, filter and reduce. Finally, it discusses other functional programming techniques in Python like partial function application, currying, and tail call optimization, while noting some of Python's limitations for functional programming like its non-pure nature and lack of pattern matching.
The basics of Python are rather straightforward. In a few minutes you can learn most of the syntax. There are some gotchas along the way that might appear tricky. This talk is meant to bring programmers up to speed with Python. They should be able to read and write Python.
This document discusses the Go programming language and why it has become popular. It notes that Go is an optional language released in 2012 that does not force developers to use it for certain applications like Java does for Android. The document states that the one main reason Go has become popular is that "It just works" - Go makes development simpler by handling things like concurrency and deployment automatically while still exposing lower-level functionality. It recommends using Go for distributed systems, portable command line tools, and situations where team productivity is important.
It is mainly about the multithreading and the multiprocessing in Python, and *in Python's flavor*.
It's also the share at Taipei.py [1].
[1] http://www.meetup.com/Taipei-py/events/220452029/
It introduces a way to implement a minimal MVC in JavaScript. This is the talk @ OSDC 2014.
[1]: http://osdc.tw/2014/
Clime is a Python library which lets you convert any module into a multi-command CLI program without any configuration.
It is a short tour of Clime.
The full documentation of Clime: http://clime.mosky.tw/.
This document discusses WordPress widgets and how they can be used to customize themes. Widgets allow modification of function and appearance and are configurable code snippets. Not all themes support widgets. Widgets can be added by dragging them from the available list onto widget areas. Common widgets include Archives, Categories, Links, and Text, which provide navigation, background content, and functionality. Widgets must have relevant content to be useful.
Automating and Accelerating Application Deployments to IBM WebSphere without ...XebiaLabs
Slides from the Jun 11, 2013 Global WebSphere Community webinar "Deploy. Faster. Automating and Accelerating Application Deployments to IBM WebSphere without Scripting"
ZIPCodeTW: Find Taiwan ZIP Code by Address FuzzilyMosky Liu
It was a lightning talk at PyCon APAC 2014 [1]. It introduces the tool to find ZIP code, ZIPCodeTW [2].
[1] http://tw.pycon.org/2014apac/
[2] http://zipcode.mosky.tw
It was the talk, titled "Graph-Tool: The Efficient Network Analyzing Tool for Python", at PyCon APAC 2014 [1] and PyCon SG 2014 [2]. It introduces you to Graph-Tool by mass code snippets.
[1] https://tw.pycon.org/2014apac
[2] https://pycon.sg/
Python is a popular programming language created by Guido van Rossum in 1991. It is easy to use, powerful, and versatile, making it suitable for beginners and experts alike. Python code can be written and executed in the browser using Google Colab, which provides a Jupyter notebook environment and access to computing resources like GPUs. The document then discusses installing Python using Anaconda, basic Python concepts like indentation, variables, strings, conditionals, and loops.
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
This document discusses various aspects of developing and distributing Python projects, including versioning, configuration, logging, file input, shell invocation, environment layout, project layout, documentation, automation with Makefiles, packaging, testing, GitHub, Travis CI, and PyPI. It recommends using semantic versioning, the logging module, parsing files with the file object interface, invoking shell commands with subprocess, using virtualenv for sandboxed environments, Sphinx for documentation, Makefiles to automate tasks, setuptools for packaging, and GitHub, Travis CI and PyPI for distribution.
Talk at PyCon2022 over building binary packages for Python. Covers an overview and an in-depth look into pybind11 for binding, scikit-build for creating the build, and build & cibuildwheel for making the binaries that can be distributed on PyPI.
The document provides examples of how Python is used in different domains such as websites, desktop applications, science, embedded systems, and more. It also discusses why Python is popular due to its readability, ease of learning, rich libraries, and ability to be sped up with tools like Numba and Cython. The document outlines topics for learning Python including primitives, control flow with if/while statements, composites like lists and dictionaries, and for loops. It recommends keeping learning through tutorials, documentation, and communities.
Python is a general purpose programming language that is often used for scripting. It was created by Guido van Rossum in 1991 and is currently in version 3.5. Python can be used for a variety of applications including web development, data science, and automation. It aims to be readable and has features like indentation and automatic memory management. The main differences between Python 2 and 3 are that print is now a function in Python 3 and some syntax changes. To learn more, resources on Python packages, tutorials, and problems are provided.
This document provides an introduction to the Python programming language. It begins by asking why Python is needed after showing a simple "Hello World" program in C versus Python. Python is then described as a dynamic, open source language designed for simplicity and productivity. Key features of Python like its interpreter-based nature, clear syntax, portability, large standard library, and suitability for many types of applications are outlined. The document demonstrates basic Python concepts like indentation, lack of variable typing, input/output, comments, and popular Python environments. It concludes by providing references to learn more about Python and announcing an upcoming PyCon conference.
Presentation used for tutorial session on Python for finalists of CSEA Code Maestros on Feb 11, 2012. More resources at http://athena.nitc.ac.in/~k4rtik/python/
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Aaron Meurer
Conda is a cross-platform package manager that can install any type of package, including Python packages, C libraries, R, and more. It addresses the "packaging problem" of dependencies and environment issues across platforms. Conda uses environments to isolate package installations and manages dependencies by using a SAT solver to resolve them before installing packages. Users can create their own conda packages using recipe files that specify metadata and build scripts.
This document provides an overview of a session on introducing Python programming. It discusses the history and creators of Python, its features as a high-level, general purpose, multi-paradigm language. Examples are given of successful organizations using Python like Google, Mozilla, and CERN. Sample Python code is shown for word counting programs. Common questions about Python versions, development environments, debugging, and performance are addressed. Reasons for Python's readability and popularity over other languages are explored. References for further learning Python are provided.
The PyConTW (http://tw.pycon.org) organizer wishes to improve the quality and quantity of the programming cummunities in Taiwan. Though Python is their core tool and methodology, they know it's worth to learn and communicate with wide-ranging communities. Understanding cultures and ecosystem of a language takes me about three to six months. This six-hour course wraps up what I - an experienced Java developer - have learned from Python ecosystem and the agenda of the past PyConTW.
你可以在以下鏈結找到中文內容:
http://www.codedata.com.tw/python/python-tutorial-the-1st-class-1-preface
This is the presentation I gave about Python 3.5 to my research group. It was my intention to introduce the Python language to some of the new members who don't know or have little knowledge about the language.
Python was developed by Guido van Rossum and named after the BBC show Monty Python's Flying Circus. It is an interpreted, interactive, and object-oriented programming language that allows developers to write code in fewer lines compared to other languages. Python code is highly readable due to its use of indentation instead of brackets and its support for modular programming.
This document discusses getting started with a first Python project. It covers installing Python and choosing an IDE, following coding best practices like PEP8 style guidelines, using built-in data structures, testing tools, virtual environments, project structure, and deployment tools like Supervisor. The goal is to help new Python programmers understand the basics of starting their first project.
Semi-motivational talk about why today is a great time to learn Python. Slides include a brief overview of the current state of the language, its application areas, and Python's future.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Niraj Bharambe
This document provides an introduction to the Python programming language. It discusses that Python is a high-level language that is easier for humans to write and understand compared to low-level languages. It can be compiled into byte code or interpreted. The document then discusses the history and origins of Python, its key features like being easy to learn and maintain, and how to install Python on different operating systems. It also covers running Python programs, debugging techniques, and setting the Python environment path and variables.
The Python Book_ The ultimate guide to coding with Python ( PDFDrive ).pdfssuser8b3cdd
This document provides an introduction to getting started with Python programming. It explains the difference between interpreted and compiled languages, walks through a simple "Hello World" Python program, and covers basic Python concepts like variables, data types, and creating and running Python files. The introduction creates a Python directory, touches a hello_world.py file, makes the file executable, adds the Python shebang and print statement, and runs the program to output "Hello World". It also defines common Python data types like integers, floats, booleans, strings, lists, tuples, and dictionaries.
This document contains slides for an introduction to Python programming course. It covers basic topics like installing Python, using the interpreter, defining functions, comments, and print statements. It provides examples of simple Python programs and emphasizes the importance of indentation in Python.
This document provides an overview of statistical regression analysis with Python. It discusses defining assumptions, validating assumptions with a dataset on extramarital affairs, performing correlation analysis, estimating models using ordinary least squares, understanding regression results including interaction effects, handling categorical variables, and addressing outliers. Modeling techniques covered include linear, logistic, and quantile regression as well as robust linear regression.
This document provides an introduction to data science with Python. It discusses key concepts in data science including visualization, statistics, machine learning, deep learning, and big data. Various Python packages are introduced for working with data, including Jupyter, NumPy, SciPy, Matplotlib, Pandas, Scikit-learn and others. The document outlines the main steps in a data science analysis process, including defining assumptions, validating assumptions with data, and iterating. Specific techniques are covered like preprocessing, dimensionality reduction, statistical modeling, and machine learning modeling. The document emphasizes an iterative approach to learning through applying concepts to problems and data.
This document discusses hypothesis testing in Python. It covers simulating and analyzing test datasets, how hypothesis tests work, common statistical tests like t-tests and chi-squared tests, and steps for completing a hypothesis test. Key points include defining the null and alternative hypotheses, estimating error rates from a confusion matrix, determining necessary sample sizes based on desired alpha and beta levels, and fully reporting test results. Other statistical analyses like correlation and regression are also briefly mentioned. Overall the document provides an introduction to performing and interpreting hypothesis tests in Python.
Writing concurrent program is hard; maintaining concurrent program even is a nightmare. Actually, a pattern which helps us to write good concurrent code is available, that is, using “channels” to communicate.
This talk will share the channel concept with common libraries, like threading and multiprocessing, to make concurrent code elegant.
It's the talk at PyCon TW 2017 [1] and PyCon APAC/MY 2017 [2].
[1]: https://tw.pycon.org/2017
[2]: https://pycon.my/pycon-apac-2017-program-schedule/
The document outlines Mosky's background as a Python engineer and speaker who works on the Python packages MoSQL and Clime. It then provides an overview of Mosky discussing topics like the Git workflow, invoice system, and seller dashboard used behind the scenes at Pinkoi. Specific instructions are given on branching, committing, pushing, reviewing, and merging code as part of the recommended Git workflow.
MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013Mosky Liu
It is the slides of the talk, "MoSQL: More than SQL, but Less than ORM", at PyCon APAC 2013. It introduces MoSQL after v0.6.
About MoSQL:
MoSQL is a Python library which lets you use common Python’s data structures to build SQLs.
http://mosql.mosky.tw/
** Please visit https://speakerdeck.com/mosky/mosql-more-than-sql-but-less-than-orm-at-pycon-apac-2013 for the newer slide. :)
It is the slides of the talk, "MoSQL: More than SQL, but Less than ORM", at PyCon TW 2013.
About MoSQL:
MoSQL is a Python library which lets you use common Python’s data structures to build SQLs, and provides a convenient model of result set.
http://mosql.mosky.tw/
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...Insurance Tech Services
A modern Policy Administration System streamlines workflows and integrates with core systems to boost speed, accuracy, and customer satisfaction across the policy lifecycle. Visit https://www.damcogroup.com/insurance/policy-administration-systems for more details!
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchMaxim Salnikov
Discover how Agentic Retrieval in Azure AI Search takes Retrieval-Augmented Generation (RAG) to the next level by intelligently breaking down complex queries, leveraging full conversation history, and executing parallel searches through a new LLM-powered query planner. This session introduces a cutting-edge approach that delivers significantly more accurate, relevant, and grounded answers—unlocking new capabilities for building smarter, more responsive generative AI applications.
Traditional Retrieval-Augmented Generation (RAG) pipelines work well for simple queries—but when users ask complex, multi-part questions or refer to previous conversation history, they often fall short. That’s where Agentic Retrieval comes in: a game-changing advancement in Azure AI Search that brings LLM-powered reasoning directly into the retrieval layer.
This session unveils how agentic techniques elevate your RAG-based applications by introducing intelligent query planning, subquery decomposition, parallel execution, and result merging—all orchestrated by a new Knowledge Agent. You’ll learn how this approach significantly boosts relevance, groundedness, and answer quality, especially for sophisticated enterprise use cases.
Key takeaways:
- Understand the evolution from keyword and vector search to agentic query orchestration
- See how full conversation context improves retrieval accuracy
- Explore measurable improvements in answer relevance and completeness (up to 40% gains!)
- Get hands-on guidance on integrating Agentic Retrieval with Azure AI Foundry and SDKs
- Discover how to build scalable, AI-first applications powered by this new paradigm
Whether you're building intelligent copilots, enterprise Q&A bots, or AI-driven search solutions, this session will equip you with the tools and patterns to push beyond traditional RAG.
Best Inbound Call Tracking Software for Small BusinessesTheTelephony
The best inbound call tracking software for small businesses offers features like call recording, real-time analytics, lead attribution, and CRM integration. It helps track marketing campaign performance, improve customer service, and manage leads efficiently. Look for solutions with user-friendly dashboards, customizable reporting, and scalable pricing plans tailored for small teams. Choosing the right tool can significantly enhance communication and boost overall business growth.
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfVarsha Nayak
In recent years, organizations have increasingly sought robust open source alternative to Jasper Reports as the landscape of open-source reporting tools rapidly evolves. While Jaspersoft has been a longstanding choice for generating complex business intelligence and analytics reports, factors such as licensing changes and growing demands for flexibility have prompted many businesses to explore other options. Among the most notable alternatives to Jaspersoft, Helical Insight stands out for its powerful open-source architecture, intuitive analytics, and dynamic dashboard capabilities. Designed to be both flexible and budget-friendly, Helical Insight empowers users with advanced features—such as in-memory reporting, extensive data source integration, and customizable visualizations—making it an ideal solution for organizations seeking a modern, scalable reporting platform. This article explores the future of open-source reporting and highlights why Helical Insight and other emerging tools are redefining the standards for business intelligence solutions.
Revolutionize Your Insurance Workflow with Claims Management SoftwareInsurance Tech Services
Claims management software enhances efficiency, accuracy, and satisfaction by automating processes, reducing errors, and speeding up transparent claims handling—building trust and cutting costs. Explore More - https://www.damcogroup.com/insurance/claims-management-software
Who will create the languages of the future?Jordi Cabot
Will future languages be created by language engineers?
Can you "vibe" a DSL?
In this talk, we will explore the changing landscape of language engineering and discuss how Artificial Intelligence and low-code/no-code techniques can play a role in this future by helping in the definition, use, execution, and testing of new languages. Even empowering non-tech users to create their own language infrastructure. Maybe without them even realizing.
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...WSO2
Enterprises must deliver intelligent, cloud native applications quickly—without compromising governance or scalability. This session explores how an internal developer platform increases productivity via AI for code and accelerates AI-native app delivery via code for AI. Learn practical techniques for embedding AI in the software lifecycle, automating governance with AI agents, and applying a cell-based architecture for modularity and scalability. Real-world examples and proven patterns will illustrate how to simplify delivery, enhance developer productivity, and drive measurable outcomes.
Learn more: https://wso2.com/choreo
A brief introduction to OpenTelemetry, with a practical example of auto-instrumenting a Java web application with the Grafana stack (Loki, Grafana, Tempo, and Mimir).
Invited Talk at RAISE 2025: Requirements engineering for AI-powered SoftwarE Workshop co-located with ICSE, the IEEE/ACM International Conference on Software Engineering.
Abstract: Foundation Models (FMs) have shown remarkable capabilities in various natural language tasks. However, their ability to accurately capture stakeholder requirements remains a significant challenge for using FMs for software development. This paper introduces a novel approach that leverages an FM-powered multi-agent system called AlignMind to address this issue. By having a cognitive architecture that enhances FMs with Theory-of-Mind capabilities, our approach considers the mental states and perspectives of software makers. This allows our solution to iteratively clarify the beliefs, desires, and intentions of stakeholders, translating these into a set of refined requirements and a corresponding actionable natural language workflow in the often-overlooked requirements refinement phase of software engineering, which is crucial after initial elicitation. Through a multifaceted evaluation covering 150 diverse use cases, we demonstrate that our approach can accurately capture the intents and requirements of stakeholders, articulating them as both specifications and a step-by-step plan of action. Our findings suggest that the potential for significant improvements in the software development process justifies these investments. Our work lays the groundwork for future innovation in building intent-first development environments, where software makers can seamlessly collaborate with AIs to create software that truly meets their needs.
Code and No-Code Journeys: The Coverage OverlookApplitools
Explore practical ways to expand visual and functional UI coverage without deep coding or heavy maintenance in this session. Session recording and more info at applitools.com
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Alluxio, Inc.
Alluxio Webinar
June 10, 2025
For more Alluxio Events: https://www.alluxio.io/events/
Speaker:
David Zhu (Engineering Manager @ Alluxio)
Storing data as Parquet files on cloud object storage, such as AWS S3, has become prevalent not only for large-scale data lakes but also as lightweight feature stores for training and inference, or as document stores for Retrieval-Augmented Generation (RAG). However, querying petabyte-to-exabyte-scale data lakes directly from S3 remains notoriously slow, with latencies typically ranging from hundreds of milliseconds to several seconds.
In this webinar, David Zhu, Software Engineering Manager at Alluxio, will present the results of a joint collaboration between Alluxio and a leading SaaS and data infrastructure enterprise that explored leveraging Alluxio as a high-performance caching and acceleration layer atop AWS S3 for ultra-fast querying of Parquet files at PB scale.
David will share:
- How Alluxio delivers sub-millisecond Time-to-First-Byte (TTFB) for Parquet queries, comparable to S3 Express One Zone, without requiring specialized hardware, data format changes, or data migration from your existing data lake.
- The architecture that enables Alluxio’s throughput to scale linearly with cluster size, achieving one million queries per second on a modest 50-node deployment, surpassing S3 Express single-account throughput by 50x without latency degradation.
- Specifics on how Alluxio offloads partial Parquet read operations and reduces overhead, enabling direct, ultra-low-latency point queries in hundreds of microseconds and achieving a 1,000x performance gain over traditional S3 querying methods.
In today's world, artificial intelligence (AI) is transforming the way we learn.
This talk will explore how we can use AI tools to enhance our learning experiences, by looking at some (recent) research that has been done on the matter.
But as we embrace these new technologies, we must also ask ourselves:
Are we becoming less capable of thinking for ourselves?
Do these tools make us smarter, or do they risk dulling our critical thinking skills?
This talk will encourage us to think critically about the role of AI in our education. Together, we will discover how to use AI to support our learning journey while still developing our ability to think critically.
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentricNatan Silnitsky
At Wix, we revolutionized our platform by making integration events the backbone of our 4,000-microservice ecosystem. By abandoning traditional domain events for standardized Protobuf events through Kafka, we created a universal language powering our entire architecture.
We'll share how our "single-aggregate services" approach—where every CUD operation triggers semantic events—transformed scalability and extensibility, driving efficient event choreography, data lake ingestion, and search indexing.
We'll address our challenges: balancing consistency with modularity, managing event overhead, and solving consumer lag issues. Learn how event-based data prefetches dramatically improved performance while preserving the decoupling that makes our platform infinitely extensible.
Key Takeaways:
- How integration events enabled unprecedented scale and extensibility
- Practical strategies for event-based data prefetching that supercharge performance
- Solutions to common event-driven architecture challenges
- When to break conventional architectural rules for specific contexts
Plooma is a writing platform to plan, write, and shape books your wayPlooma
Plooma is your all in one writing companion, designed to support authors at every twist and turn of the book creation journey. Whether you're sketching out your story's blueprint, breathing life into characters, or crafting chapters, Plooma provides a seamless space to organize all your ideas and materials without the overwhelm. Its intuitive interface makes building rich narratives and immersive worlds feel effortless.
Packed with powerful story and character organization tools, Plooma lets you track character development and manage world building details with ease. When it’s time to write, the distraction-free mode offers a clean, minimal environment to help you dive deep and write consistently. Plus, built-in editing tools catch grammar slips and style quirks in real-time, polishing your story so you don’t have to juggle multiple apps.
What really sets Plooma apart is its smart AI assistant - analyzing chapters for continuity, helping you generate character portraits, and flagging inconsistencies to keep your story tight and cohesive. This clever support saves you time and builds confidence, especially during those complex, detail packed projects.
Getting started is simple: outline your story’s structure and key characters with Plooma’s user-friendly planning tools, then write your chapters in the focused editor, using analytics to shape your words. Throughout your journey, Plooma’s AI offers helpful feedback and suggestions, guiding you toward a polished, well-crafted book ready to share with the world.
With Plooma by your side, you get a powerful toolkit that simplifies the creative process, boosts your productivity, and elevates your writing - making the path from idea to finished book smoother, more fun, and totally doable.
Get Started here: https://www.plooma.ink/
Top 5 Task Management Software to Boost Productivity in 2025Orangescrum
In this blog, you’ll find a curated list of five powerful task management tools to watch in 2025. Each one is designed to help teams stay organized, improve collaboration, and consistently hit deadlines. We’ve included real-world use cases, key features, and data-driven insights to help you choose what fits your team best.
Providing Better Biodiversity Through Better DataSafe Software
This session explores how FME is transforming data workflows at Ireland’s National Biodiversity Data Centre (NBDC) by eliminating manual data manipulation, incorporating machine learning, and enhancing overall efficiency. Attendees will gain insight into how NBDC is using FME to document and understand internal processes, make decision-making fully transparent, and shine a light on underlying code to improve clarity and reduce silent failures.
The presentation will also outline NBDC’s future plans for FME, including empowering staff to access and query data independently, without relying on external consultants. It will also showcase ambitions to connect to new data sources, unlock the full potential of its valuable datasets, create living atlases, and place its valuable data directly into the hands of decision-makers across Ireland—ensuring that biodiversity is not only protected but actively enhanced.
FME for Climate Data: Turning Big Data into Actionable InsightsSafe Software
Regional and local governments aim to provide essential services for stormwater management systems. However, rapid urbanization and the increasing impacts of climate change are putting growing pressure on these governments to identify stormwater needs and develop effective plans. To address these challenges, GHD developed an FME solution to process over 20 years of rainfall data from rain gauges and USGS radar datasets. This solution extracts, organizes, and analyzes Next Generation Weather Radar (NEXRAD) big data, validates it with other data sources, and produces Intensity Duration Frequency (IDF) curves and future climate projections tailored to local needs. This presentation will showcase how FME can be leveraged to manage big data and prioritize infrastructure investments.
2. Mosky:
● The examples and the PDF version are available at:
– j.mp/mosky-programming-with-python.
● It is welcome to give me any advice of this slide or
ask me the answers of the challenges.
– mosky.tw
2
5. Topics
● Basic Topics ● Adv. Topics
– Python 2 or 3? – Module and Package
– Environment – Typing
– hello.py – Comprehension
– Common Types – Functional Technique
– Flow Control – Object-oriented Prog.
– File I/O – Useful Libraries
– Documentation ● Final Project
– Scope – A Blog System
5
6. An Investigation
Do you know _________ ?
– any other programming language
– Object-oriented
– Static Typing; Strong and Weak Typing
– Dynamic Typing
– Functor; Closure
– Functional Programming
– Web development
6
8. Python 2 or 3?
● Python 2.x ● Python 3.x
– status quo – present & future
– 2.7 is end-of-life release – under active development
– harder for newcomers – easier for newcomers
– more third-party lib. – less third-party lib.
– 2to3.py – 3to2.py
– backported features: – new features:
● What's News in Python 2.6 ● What's News in Python 3.0
docs.python.org/release/2.6.4/whatsnew/2.6.html docs.python.org/py3k/whatsnew/3.0.html
● What's News in Python 2.7
docs.python.org/dev/whatsnew/2.7.html
8
9. Python 2 or 3? (cont.)
● Use Python 3 if you can.
● Decide Python 2 or 3 by the libraries you will use.
● Today, we will go ahead with Python 2.
And introduce you to the changes in Python3.
9
11. On Linux or Mac
● Python is built-in on Linux or Mac.
● All you have to do is check the version.
Type "python" in any terminal.
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>>>
11
12. On Windows
● Download the installer from:
"http://python.org/download"
● Install it.
● Add the Python's PATH.
– Computer → System Properties → Advanced system
settings → Advanced tab → Environment Variables →
System Variables → find PATH.
– "...;C:Python27"
12
13. Editor / IDE
● The Editors ● The IDE
– Sublime Text 2 – IDLE
www.sublimetext.com
● Debian-base:
– VIM sudo apt-get install idle
wiki.python.org/moin/Vim ● Windows:
– Gnome Text Editor Use the Start Menu to
(gedit) search "IDLE"
– Notepad++
● The others:
notepad-plus-plus.org – wiki.python.org/moin/PythonEditors
– ...
13
14. The Python Shell
● Type "python" in terminal.
– >>>
– ...
● Leaving a shell:
– exit()
– Linux or Mac: Ctrl+D
– Windows: Ctrl+Z<Enter>
14
15. The python Command
● Enter Python shell without arguments.
● python hello.py
● python -c 'print "Hello, World!"'
● python -m SimpleHTTPServer
15
17. hello.py
#!/usr/bin/env python
● #! the shebang.
# -*- coding: utf-8 -*- ● # -*- defines the encoding
# file: hello.py of this file.
● # means the comments.
def hello(name=None):
if name:n ● : starts a block.
return 'Hello, %s!' %
name
else: ● A block uses 4-space indent.
return 'Hello, Python!' ● A statement ends with n.
17
18. hello.py (cont.)
if __name__ == '__main__':
● __name__, the name of
module.
import sys
if len(sys.argv) >= 2: ● import is important.
print The usage:
hello(sys.argv[1])
else:
● import sys
print hello() ● from sys import argv
● … as alias
18
20. The print Statement
print 'End with a new line char.'
print 'Print', 'multiple', 'strings.'
print 'End with a space.',
print # print a new line char
20
21. The print function in Python 3
print('End with a new line char.')
print('Print', 'multiple', 'strings.')
print('End with a space.', end=' ')
print() # print a new line char
print('End with a space.', end='')
print('a', 'b', 'c', seq=',')
21
37. List and Tuple
List (mutable seq.) Tuple (seq.)
– [] – tuple()
– ['item'] – ('item', )
– ['s', 100, u'unicode'] – ('s', 100, u'unicode')
– list('abc') – tuple('abc')
– 'a b c'.split(' ')
– 'n'.join(['spam', – 'n'.join(('spam',
'eggs']) 'eggs'))
– x, y = [1, 2] – x, y = (1, 2)
– x, y = [y, x] – x, y = (y, x)
37
38. Sequence
Sequence Mutable Seq.
– s[i] = x
– x in s # performance? – s[i:j] = t
– x not in s – del s[i:j]
– s + t – s[i:j:k] = t
– s * n, n * s – s.append(x)
– s.insert(i, x)
– s[i] – s.pop([i])
– s[i:j] – s.remove(x) # performance?
– s[i:j:k] – s.extend(t)
in-place
– len(s)
– s.sort([cmp[, key[, reverse]]])
– s.index(x) – s.sort([key[, reverse]]) # Py 3
– s.count(x) – s.reverse()
38
41. Sequence (cont.)
Slicing and Slice object:
– s = range(10) – s = 'I am a str.'
– t = s – s[:-3]
– t[0] = 'A'
– print s – s.reverse()
– t is s → TypeError
– s[::-1]
– t = s[:] – ''.join(reversed(s))
– t is s
– slice(None, None, -1)
41
42. Mapping
Dict. (mutable map.)
– len(d)
– {}
– d[k]
– {'A ': 1, 'B': 2, 'C': 3} – d[k] = v
– dict({...}) – del d[k]
– dict(A=1, B=2, C=3) – k in d, k not in d
– d.copy()
– d.get(key[, default])
– k = 'ABC' – d.setdefault(key[, default])
– v = [1, 2, 3] – d.items(), d.keys(), d.values()
– pairs = zip(k, v) – d.pop(key[, default)
– dict(pairs) – d.update([other])
...
42
43. Set
Set (mutable set)
– len(s)
– set() – x in s, x not in s
– {'A', 'B', 'C'} # Py3 – s.copy()
– s.add(elem)
– set('ABC') – s.discard(elem)
– set(['A','B','C']) – s.pop()
– s |= other
– s &= other
– s | other | ...
– s & other & ...
– s < | <= | == | > = | > other
...
43
45. The if Statement
if [condition 1]:
…
elif [condition 2]:
…
elif [condition 3]:
…
else:
…
[exp. if true] if [condition] else [exp. if false]
45
46. Truth Value Testing
They are same as False in a boolean context:
– None
– False
– Zeros (ex. 0, 0.0, 0L, 0j)
– Empty containers (ex. '', [], {})
– __nonzero__() or __len__() returns 0 or False
46
47. Truth Value Testing (cont.)
● if not None: ...
● if not []: ...
● if [0]: ...
● if [[]]: ...
● if "": ...
● if {}: ...
● if not {0: False}: …
…
47
48. The for Statement
for [item] in [iterable]: for i in [0, 1, 2]:
… print i
for i in range(3): for i in xrange(3):
print i print i
48
49. The for Statement in Python 3
for [item] in [iterable]: for i in [0, 1, 2]:
… print i
for i in range(3): for i in xrange(3):
print i print i
49
50. The for Statement (cont.)
for i in range(1, 3): for i in range(3, -1, -1):
print i print i
s = [1, 2, 3] s = [...]
t = 'xyz' for i, item in enumerate(s):
print i, item
for i, j in zip(s, t):
print i, j
50
51. The for Statement (cont.)
● It is like for … each in other language.
– Note: Python hasn't other for loop.
● It can iterate all of iterable object.
– In other words, the object which defined __iter__.
– ex. sequence, mapping, set, ...
51
52. Challenge 1: A Pyramid
● Use for loop to build a *
pyramid on right. ***
– without limit. *****
– limit: in two lines *******
● hint: string formatting
52
53. Challenge 2-1: Count the Chars
● Use for loop to count "Please count the
the sentence on right. characters here."
– without limit.
– limit: without if
● hint: use get
{'P': 1, ...}
53
54. Challenge 2-2: Collect the Chars
● Use for loop to collect "Here are UPPERCASE
the chars. and lowercase chars."
– limit: use setdefault
{'c': ['C', 'c',
'c'], ...}
54
55. The while Statement
tasks = [...]
while tasks: while 1:
… …
● It leaves the loop once ● A infinite loop.
the tasks is empty. ● It is better to use block
mechanism in a loop.
– ex. I/O block
55
56. The break, continue Statement
loop …: loop …:
if …: break if …: continue
● It terminates a loop. ● It continues with the
next iteration.
56
57. The break, continue Statement (cont.)
● They do the same thing in both C and Python.
● Using break or continue is encouraged.
– take the place of the complicated condition in a while.
– faster, because Python is interpreted.
● Just use them.
57
59. The else Clause on Loops
loop …:
…
else:
…
● No a clause on the if statement!
● If the loop isn't broken by any break statement, the
else block is executed.
● It replaces the flags we usually used.
59
60. Challenge 3-1: The Primes
● Try to filter the primes [2, 3, 5, 7, 11, 13,
from [2, 100). 17, 19, 23, 29, 31,
37, 41, 43, 47, 53,
– without limit. 59, 61, 67, 71, 73,
– limit: use loop's else 79, 83, 89, 97]
60
62. The try Statement in Python 3
try:
…
except LookupError as e:
…
except (IndexError, KeyError) as e:
…
else:
…
finally:
…
62
63. The try Statement (cont.)
● For avoiding to catch the exception we don't expect, you should:
– reduce your code in try block.
●
move them to else block.
– make the exception precise in except statement.
● Avoid using Exception.
● ref: docs.python.org/2/library/exceptions.html#exception-hierarchy
● Release the resource in finally block.
– or use context manager
– ex. file, socket, …
● raise SomeError
63
69. The def Statement (cont.)
def f(): pass
def g(): pass
d = {'x': f, 'y': g}
d['x']()
● Python functions are first-class functions.
– It means you can pass functions as arguments, and
assign functions to variables.
– It is like the function pointers in C.
69
70. An Example of Using while, try and def.
# file: ex_try.py $ python ex_try.py
def take_int(prompt='Give me a int: '):
Give me a int: str
while 1:
try:
It is not a int!
user_input = int(raw_input(prompt)) Give me a int: abc
except ValueError, e:
print 'It is not a int!' It is not a int!
else:
return user_input Give me a int: 100
if __name__ == '__main__':
I got a int from user:
x = take_int() 100
print 'I got a int from user: %d' % x
$
70
71. A Trap of the Default Value
# file: ex_defval_trap.py ● Because the list is
created when the
def f(items=[]): function is defined.
items.append(1)
return items
● Avoid to use the
mutable types as the
if __name__ == '__main__': default value.
print f() # -> [1]
print f() # -> [1, 1]
print f() # -> [1, 1, 1]
71
72. Challenge 4: A BMI Calculator
● BMI: Body Mass Index Enter your height (M):
– BMI = weight (KG) ÷ height (M)2 1.63
– < 18.5 → Underweight
Enter your weight (KG):
– [18.5, 25) → Normal weight
– [25, 30) → Overweight 49
– >= 30 → Obesity ---
● Write a BMI calculator.
Your BMI is:
– without limit.
– limit: only one if
18.44 (Underweight)
● hint: use loop Ideal weight is between:
49.15 ~ 66.42
72
74. The file Object
f = open('input.txt') f =
print f.read() open('output.txt',
'w')
f.seek(0)
f.write('a line.n')
for line in f:
f.close()
print line,
f.close()
74
75. The Context Manager
with open('input.txt') as f:
for line in f:
print line,
f.close()
● Python 2.5↑
– Python 2.5.x: from __future__ import with_statement
– Python 2.6↑: It is mandatory.
75
76. Challenge 2: Count the Chars (cont.)
– limit 3: with the files The path of input:
input.txt
The path of output:
output.txt
---
The result was
written.
76
77. The csv Moudle
#!/usr/bin/env python 1, apple
# -*- coding: utf-8 -*- 2, orange
# file: ex_csv.py
3, watermelon
import csv
['1', ' apple']
with open('ex_csv.csv') as f:
['2', ' orange']
for row in csv.reader(f):
print row ['3', ' watermelon']
77
78. The os.path Moudle
# file: ex_os_path.py $ python ex_os_path.py
from os import walk
from os.path import join
It requires a path as
def list_files(path):
paths = []
argument.
for root, dir_names, file_names in walk(path):
for file_name in file_names:
paths.append(join(root, file_name))
$ python ex_os_path.py .
return paths
…/1
if __name__ == '__main__':
import sys
…/b/4
from os.path import abspath, dirname
if len(sys.argv) == 2:
…/a/2
path = abspath(dirname(sys.argv[1]))
for path in list_files(path): …/a/3
print path
else:
print 'It requires a path as argument.'
78
80. The help Function
● In Python shell: ● In terminal:
– help(open) – $ pydoc SimpleHTTPServer
– dir(open) – $ pydoc csv
– $ pydoc os.path
– 'n'.join(dir(open))
80
81. Your Documentation
$ pydoc ex_doc
# file: ex_doc.py Help on module ex_doc:
'''module-level doc.''' NAME
ex_doc - module-level doc.
def f(x): FILE
'''A short sentence describes
this function. /home/mosky/programming-with-python/ex_doc.py
FUNCTIONS
About the parameters, return f(x)
value or any other detail ... A short sentence describes this
''' function.
pass
About the parameters, return value or
any other detail ...
81
83. Scope
# file: ex_scope.py $ python ex_scope.py
global
x = 'global'
local
def f():
$
if 1:
x = 'local'
return x
● Scopes are decided by
functions.
if __name__ == '__main__':
print x
print f()
83
84. The LEGB Rule
# file: ex_LEGB.py ● return …
global_var = 100 – Local (in function)
def f():
enclosed_var = 10
– Enclosed
def g():
– Global
local_var = 1
return sum([local_var, enclosed_var,
– Built-in
global_var])
return g()
if __name__ == '__main__':
print f() # -> 111
84
86. Challenge 5: Mix All
● You have many $ python mix.py pyramid 10
functions now. …
$ python mix.py primes 100
Try to write a CLI
…
program to trigger your
$ python mix.py bmi 1.63 49
functions.
…
– without limit
$ python mix.py blah blah
– limit: without if. Please check your args.
86