Day 1 Slide Handout for my training course, Well Grounded Python Coding. I'm using PyCharm Pro and Anaconda along the course. Not much to read but it's the main material for my teaching.
These are the slides of the second part of this multi-part series, from Learn Python Den Haag meetup group. It covers List comprehensions, Dictionary comprehensions and functions.
This document provides an overview of Python fundamentals including basic concepts like data types, operators, flow control, functions and classes. It begins with an introduction to Python versions and environments. The outline covers topics like Hello World, common types and operators for numeric, string and container data types. It also discusses flow control structures like if/else, while loops and for loops. Finally, it briefly mentions functions, classes, exceptions and file I/O.
Introduction to the basics of Python programming (part 3)Pedro Rodrigues
This is the 3rd part of a multi-part series that teaches the basics of Python programming. It covers list and dict comprehensions, functions, modules and packages.
This document discusses advanced geoprocessing using Python. It provides an outline and overview of Python programming concepts for geoprocessing including data types, functions, procedural versus object-oriented programming, geometries, rasters, and error handling. Specific Python coding examples are provided for strings, lists, dictionaries, tuples, sets, and reading geometry from feature classes. The document also discusses modularizing code using import statements and custom modules to reuse code.
Python 3.6 includes several new features and improvements related to asynchronous programming and language syntax. PEP 525 introduces asynchronous generators to allow async and await in generator functions. PEP 530 adds asynchronous comprehensions for concise creation of asynchronous iterators. Other PEPs improve class attribute definition order preservation, string formatting syntax, and the addition of asynchronous APIs to the standard library. Python 3.6 continues Python's progress towards native asynchronous programming capabilities.
This document provides a summary of Python concepts including:
1. Python is an interpreted, object-oriented, and high-level programming language with features like being easy to read, productive, portable and having a big library.
2. Key Python concepts covered include variables, data types, objects, lists, dictionaries, tuples, control structures, functions and files.
3. The document uses examples and explanations to introduce Python building blocks like variables, data types, lists, dictionaries, control flow and functions. It also discusses how Python interacts with files.
These are the slides of the second part of this multi-part series, from Learn Python Den Haag meetup group. It covers List comprehensions, Dictionary comprehensions and functions.
This document provides an overview of Python fundamentals including basic concepts like data types, operators, flow control, functions and classes. It begins with an introduction to Python versions and environments. The outline covers topics like Hello World, common types and operators for numeric, string and container data types. It also discusses flow control structures like if/else, while loops and for loops. Finally, it briefly mentions functions, classes, exceptions and file I/O.
Introduction to the basics of Python programming (part 3)Pedro Rodrigues
This is the 3rd part of a multi-part series that teaches the basics of Python programming. It covers list and dict comprehensions, functions, modules and packages.
This document discusses advanced geoprocessing using Python. It provides an outline and overview of Python programming concepts for geoprocessing including data types, functions, procedural versus object-oriented programming, geometries, rasters, and error handling. Specific Python coding examples are provided for strings, lists, dictionaries, tuples, sets, and reading geometry from feature classes. The document also discusses modularizing code using import statements and custom modules to reuse code.
Python 3.6 includes several new features and improvements related to asynchronous programming and language syntax. PEP 525 introduces asynchronous generators to allow async and await in generator functions. PEP 530 adds asynchronous comprehensions for concise creation of asynchronous iterators. Other PEPs improve class attribute definition order preservation, string formatting syntax, and the addition of asynchronous APIs to the standard library. Python 3.6 continues Python's progress towards native asynchronous programming capabilities.
This document provides a summary of Python concepts including:
1. Python is an interpreted, object-oriented, and high-level programming language with features like being easy to read, productive, portable and having a big library.
2. Key Python concepts covered include variables, data types, objects, lists, dictionaries, tuples, control structures, functions and files.
3. The document uses examples and explanations to introduce Python building blocks like variables, data types, lists, dictionaries, control flow and functions. It also discusses how Python interacts with files.
This document provides an introduction to the Python language and discusses Python data types. It covers how to install Python, interact with the Python interpreter through command line and IDLE modes, and learn basic Python parts like data types, operators, functions, and control structures. The document discusses numeric, string, and other data types in Python and how to manipulate them using built-in functions and operators. It also introduces Python library modules and the arcpy package for geoprocessing in ArcGIS.
Many developers will be familiar with lex, flex, yacc, bison, ANTLR, and other related tools to generate parsers for use inside their own code. For recognizing computer-friendly languages, however, context-free grammars and their parser-generators leave a few things to be desired. This is about how the seemingly simple prospect of parsing some text turned into a new parser toolkit for Erlang, and why functional programming makes parsing fun and awesome
Inspired by Josh Bloch's Java Puzzlers, we put together our own Python Puzzlers. This slide deck brings you a set of 10 python puzzlers, that are fun and educational. Each puzzler will show you a piece of python code. Your task if to figure out what happens when the code is run. Whether you're a python beginner or a passionate python veteran, we hope that there's something to learn for everybody.
This slide deck was first presented at shopkick. Nandan Sawant and Ryan Rueth are engineers at shopkick. Keeping the audience in mind, most of the puzzlers are based on python 2.x.
In Python, operator overloading is accomplished via "magic methods" -- specially named methods that begin and end with double underscore ("dunder"). Most Python developers know about __init__ and even __str__, but magic methods are used to accomplish many things in the Python world. In this talk, I introduce a number of these methods, and show how they can be used to make our objects more expressive.
This document provides information on arrays in Java, including:
- Arrays are used to store multiple values of the same type in a single variable. There are single-dimensional and multi-dimensional arrays.
- Arrays are initialized using the new keyword, and elements can be accessed by their index. The length property returns the size of the array.
- Loops like for can be used to iterate through arrays. Multi-dimensional arrays contain one or more arrays. Jagged arrays can have rows of different lengths.
- The print() and println() methods differ in that println() adds a new line while print() does not.
This document provides an overview of biological databases and SQL. It discusses different data levels in biological research like primary data, derived data, and interpreted data. It also summarizes some popular biological databases like Ensembl, ArrayExpress, and PharmGKB and whether they support direct SQL querying. The document then provides definitions for key database concepts like database, table, record, and query. It also describes different data types in SQL like numeric, string, date/time types and large object types. It discusses keys, integrity rules, and referential integrity in database design.
Beginners python cheat sheet - Basic knowledge O T
The document provides an overview of common Python data structures and programming concepts including variables, strings, lists, tuples, dictionaries, conditionals, functions, files, classes, and more. It includes examples of how to define, access, modify, loop through, and perform operations on each type of data structure. Key points covered include using lists to store ordered sets of items, dictionaries to store connections between pieces of information as key-value pairs, and classes to define custom object types with attributes and methods.
Getting started in Python presentation by Laban KGDSCKYAMBOGO
Python Overview and getting started in Python Language. It includes on how to install, run it and carrying out some simple python codes in different environments(IDLEs)
Beyond xUnit example-based testing: property-based testing with ScalaCheckFranklin Chen
Test-Driven Development has become deservedly popular in the past decade, with easy-to-use xUnit unit testing frameworks leading the way toward encouraging developers to write tests. But xUnit has limitations: how does one know one has written enough test cases for a desired behavior? And what if the behavior is conditional on other behavior? Property-based testing, first popularized for Haskell with the QuickCheck library, but available now for other languages as well, offers a powerful addition to one's testing toolkit.
I will discuss the concepts of property-based testing and illustrate them concretely using ScalaCheck for Scala, and point toward similar test frameworks in other languages.
Babar: Knowledge Recognition, Extraction and RepresentationPierre de Lacaze
Babar is a research project in the field of Artificial Intelligence. It aims to bridge together Neural AI and Symbolic AI. As such it is implemented in three different programming languages: Clojure, Python and CLOS.
The Clojure component (Clobar) implements the graphical user interface to Babar. Examples of the Clojure Hiccup library and interfacing Clojure to Javascript will be presented. The Python module (Pybar) implements the web crawling and scraping and the Neural Networks aspect of Babar. The Word Embedding and and LSTM (Long Short-Term Memory) components of Pybar will be described in detail. Finally the Common Lisp module (Lispbar) implements the Symbolic AI aspect of Babar. This latter includes an English Language Parser and Semantic Networks implemented as an in-memory Hypergraph.
We will present each of these components and target individual aspects with code examples. Specifically we will first present the web developments and Neural Networks components. Then the English Language parser will be examined in detail. We will also present the knowledge extraction aspect and bridge this with the Neural Network component.
Ultimately we will argue what can be termed "Neural AI" and "Symbolic AI" are at not at odds with each other but rather complement each other. In summary Artificial Intelligence is not a question of "brain" or "mind", but rather a question of "brain" and "mind".
1. Python provides various built-in container types including lists, tuples, dictionaries, sets, and strings for storing and organizing data.
2. These container types support common operations like indexing, slicing, membership testing, and methods for insertion, deletion, and modification.
3. The document provides examples of using operators and built-in functions to perform tasks like formatting strings, file I/O, conditional logic, loops, functions, and exceptions.
This document summarizes an event being organized by the Department of Computer Science Engineering and Department of Electronics and Instrumentation Engineering at Kamaraj College of Engineering and Technology. The event is called "TECHSHOW '19" and is aimed at +2 school students. It will take place on November 30th, 2019 and will include notes on Python programming, including topics like sequence containers, indexing, base types, and functions.
Presented at 8th Light University London (13th May 2016)
Do this, do that. Coding from assembler to shell scripting, from the mainstream languages of the last century to the mainstream languages now, is dominated by an imperative style. From how we teach variables — they vary, right? — to how we talk about databases, we are constantly looking at state as a thing to be changed and programming languages are structured in terms of the mechanics of change — assignment, loops and how code can be threaded (cautiously) with concurrency.
Functional programming, mark-up languages, schemas, persistent data structures and more are all based around a more declarative approach to code, where instead of reasoning in terms of who does what to whom and what the consequences are, relationships and uses are described, and the flow of execution follows from how functions, data and other structures are composed. This talk will look at the differences between imperative and declarative approaches, offering lessons, habits and techniques that are applicable from requirements through to code and tests in mainstream languages.
The document provides an overview of decision trees and machine learning techniques. It discusses how decision trees can be used to classify data and extract patterns, describes the ID3 algorithm for building decision trees using information gain, and notes some extensions to ID3 like C4.5 which allow continuous values and pruning of trees.
Monads and Monoids: from daily java to Big Data analytics in Scala
Finally, after two decades of evolution, Java 8 made a step towards functional programming. What can Java learn from other mature functional languages? How to leverage obscure mathematical abstractions such as Monad or Monoid in practice? Usually people find it scary and difficult to understand. Oleksiy will explain these concepts in simple words to give a feeling of powerful tool applicable in many domains, from daily Java and Scala routines to Big Data analytics with Storm or Hadoop.
Functional Python Webinar from October 22nd, 2014Reuven Lerner
Slides from my free functional Python webinar, given on October 22nd, 2014. Discussion included functional programming as a perspective, passing functions as data, and writing programs that take functions as parameters. Includes (at the end) a coupon for my new ebook, Practice Makes Python.
This document provides an introduction to the Python language and discusses Python data types. It covers how to install Python, interact with the Python interpreter through command line and IDLE modes, and learn basic Python parts like data types, operators, functions, and control structures. The document discusses numeric, string, and other data types in Python and how to manipulate them using built-in functions and operators. It also introduces Python library modules and the arcpy package for geoprocessing in ArcGIS.
Many developers will be familiar with lex, flex, yacc, bison, ANTLR, and other related tools to generate parsers for use inside their own code. For recognizing computer-friendly languages, however, context-free grammars and their parser-generators leave a few things to be desired. This is about how the seemingly simple prospect of parsing some text turned into a new parser toolkit for Erlang, and why functional programming makes parsing fun and awesome
Inspired by Josh Bloch's Java Puzzlers, we put together our own Python Puzzlers. This slide deck brings you a set of 10 python puzzlers, that are fun and educational. Each puzzler will show you a piece of python code. Your task if to figure out what happens when the code is run. Whether you're a python beginner or a passionate python veteran, we hope that there's something to learn for everybody.
This slide deck was first presented at shopkick. Nandan Sawant and Ryan Rueth are engineers at shopkick. Keeping the audience in mind, most of the puzzlers are based on python 2.x.
In Python, operator overloading is accomplished via "magic methods" -- specially named methods that begin and end with double underscore ("dunder"). Most Python developers know about __init__ and even __str__, but magic methods are used to accomplish many things in the Python world. In this talk, I introduce a number of these methods, and show how they can be used to make our objects more expressive.
This document provides information on arrays in Java, including:
- Arrays are used to store multiple values of the same type in a single variable. There are single-dimensional and multi-dimensional arrays.
- Arrays are initialized using the new keyword, and elements can be accessed by their index. The length property returns the size of the array.
- Loops like for can be used to iterate through arrays. Multi-dimensional arrays contain one or more arrays. Jagged arrays can have rows of different lengths.
- The print() and println() methods differ in that println() adds a new line while print() does not.
This document provides an overview of biological databases and SQL. It discusses different data levels in biological research like primary data, derived data, and interpreted data. It also summarizes some popular biological databases like Ensembl, ArrayExpress, and PharmGKB and whether they support direct SQL querying. The document then provides definitions for key database concepts like database, table, record, and query. It also describes different data types in SQL like numeric, string, date/time types and large object types. It discusses keys, integrity rules, and referential integrity in database design.
Beginners python cheat sheet - Basic knowledge O T
The document provides an overview of common Python data structures and programming concepts including variables, strings, lists, tuples, dictionaries, conditionals, functions, files, classes, and more. It includes examples of how to define, access, modify, loop through, and perform operations on each type of data structure. Key points covered include using lists to store ordered sets of items, dictionaries to store connections between pieces of information as key-value pairs, and classes to define custom object types with attributes and methods.
Getting started in Python presentation by Laban KGDSCKYAMBOGO
Python Overview and getting started in Python Language. It includes on how to install, run it and carrying out some simple python codes in different environments(IDLEs)
Beyond xUnit example-based testing: property-based testing with ScalaCheckFranklin Chen
Test-Driven Development has become deservedly popular in the past decade, with easy-to-use xUnit unit testing frameworks leading the way toward encouraging developers to write tests. But xUnit has limitations: how does one know one has written enough test cases for a desired behavior? And what if the behavior is conditional on other behavior? Property-based testing, first popularized for Haskell with the QuickCheck library, but available now for other languages as well, offers a powerful addition to one's testing toolkit.
I will discuss the concepts of property-based testing and illustrate them concretely using ScalaCheck for Scala, and point toward similar test frameworks in other languages.
Babar: Knowledge Recognition, Extraction and RepresentationPierre de Lacaze
Babar is a research project in the field of Artificial Intelligence. It aims to bridge together Neural AI and Symbolic AI. As such it is implemented in three different programming languages: Clojure, Python and CLOS.
The Clojure component (Clobar) implements the graphical user interface to Babar. Examples of the Clojure Hiccup library and interfacing Clojure to Javascript will be presented. The Python module (Pybar) implements the web crawling and scraping and the Neural Networks aspect of Babar. The Word Embedding and and LSTM (Long Short-Term Memory) components of Pybar will be described in detail. Finally the Common Lisp module (Lispbar) implements the Symbolic AI aspect of Babar. This latter includes an English Language Parser and Semantic Networks implemented as an in-memory Hypergraph.
We will present each of these components and target individual aspects with code examples. Specifically we will first present the web developments and Neural Networks components. Then the English Language parser will be examined in detail. We will also present the knowledge extraction aspect and bridge this with the Neural Network component.
Ultimately we will argue what can be termed "Neural AI" and "Symbolic AI" are at not at odds with each other but rather complement each other. In summary Artificial Intelligence is not a question of "brain" or "mind", but rather a question of "brain" and "mind".
1. Python provides various built-in container types including lists, tuples, dictionaries, sets, and strings for storing and organizing data.
2. These container types support common operations like indexing, slicing, membership testing, and methods for insertion, deletion, and modification.
3. The document provides examples of using operators and built-in functions to perform tasks like formatting strings, file I/O, conditional logic, loops, functions, and exceptions.
This document summarizes an event being organized by the Department of Computer Science Engineering and Department of Electronics and Instrumentation Engineering at Kamaraj College of Engineering and Technology. The event is called "TECHSHOW '19" and is aimed at +2 school students. It will take place on November 30th, 2019 and will include notes on Python programming, including topics like sequence containers, indexing, base types, and functions.
Presented at 8th Light University London (13th May 2016)
Do this, do that. Coding from assembler to shell scripting, from the mainstream languages of the last century to the mainstream languages now, is dominated by an imperative style. From how we teach variables — they vary, right? — to how we talk about databases, we are constantly looking at state as a thing to be changed and programming languages are structured in terms of the mechanics of change — assignment, loops and how code can be threaded (cautiously) with concurrency.
Functional programming, mark-up languages, schemas, persistent data structures and more are all based around a more declarative approach to code, where instead of reasoning in terms of who does what to whom and what the consequences are, relationships and uses are described, and the flow of execution follows from how functions, data and other structures are composed. This talk will look at the differences between imperative and declarative approaches, offering lessons, habits and techniques that are applicable from requirements through to code and tests in mainstream languages.
The document provides an overview of decision trees and machine learning techniques. It discusses how decision trees can be used to classify data and extract patterns, describes the ID3 algorithm for building decision trees using information gain, and notes some extensions to ID3 like C4.5 which allow continuous values and pruning of trees.
Monads and Monoids: from daily java to Big Data analytics in Scala
Finally, after two decades of evolution, Java 8 made a step towards functional programming. What can Java learn from other mature functional languages? How to leverage obscure mathematical abstractions such as Monad or Monoid in practice? Usually people find it scary and difficult to understand. Oleksiy will explain these concepts in simple words to give a feeling of powerful tool applicable in many domains, from daily Java and Scala routines to Big Data analytics with Storm or Hadoop.
Functional Python Webinar from October 22nd, 2014Reuven Lerner
Slides from my free functional Python webinar, given on October 22nd, 2014. Discussion included functional programming as a perspective, passing functions as data, and writing programs that take functions as parameters. Includes (at the end) a coupon for my new ebook, Practice Makes Python.
This document provides an outline and overview of a presentation on Python programming. The outline includes sections on what Python is, why Python, an introduction to Python, Python programming tips and tricks, more on Python, and the scientific module. Under each section, there are bullet points explaining key aspects of Python like its design, uses, basic syntax, data structures, functions, classes, modules, and popular scientific programming libraries like NumPy.
Python can be used for a variety of applications including web development, scientific computing, education, desktop GUIs, and software development. It is commonly used to build web applications using frameworks like Django and Flask, for scientific computing tasks using libraries like NumPy and SciPy, and for general software development tasks like build automation and testing. Python supports a range of data types including integers, floats, complex numbers, lists, dictionaries, sets, and strings. It can be used to write functions and programs to solve problems across many domains.
This document contains notes from a Python class covering functions, lists, strings, and their methods. It discusses built-in functions like len(), range(), and type conversions. It also covers control flow structures like if/else, for loops, exceptions, modules, and functions in more detail including defining functions, parameters, arguments, returning values, docstring, and variable scopes. Assignments include writing functions to process lists and check for palindromes in strings.
This document provides an introduction to the Python programming language. It discusses why Python is useful, highlighting that it is easy to read and learn, has a powerful interactive interpreter, and is scalable and high-level. It also outlines key features like being procedural, object-oriented, and dynamically typed. The document then discusses popular domains where Python is used, like web development, machine learning, and data analysis. It covers execution modes, variables, data types, operators, conditional execution, functions, and building a "Who Wants to Be a Millionaire" game in Python.
My Scala by the Bay 2014 talk on exploring the ideas behind the implementation of the generic library shapeless, and general ideas about how to do "type level" programming in Scala.
Basic Python Programming: Part 01 and Part 02Fariz Darari
This document discusses basic Python programming concepts including strings, functions, conditionals, loops, imports and recursion. It begins with examples of printing strings, taking user input, and calculating areas of shapes. It then covers variables and data types, operators, conditional statements, loops, functions, imports, strings, and recursion. Examples are provided throughout to demonstrate each concept.
The document discusses principles and best practices for writing high-quality code, including keeping code simple, avoiding duplication, using object-oriented design principles like SOLID, giving variables and methods meaningful names, properly structuring classes, methods and variables, and applying principles of encapsulation and inheritance. It emphasizes that code quality is important to reduce development costs and improve productivity.
This PPT gives information about:
1. WHERE condintion,
2. Order By,
3. Group By,
4. SQL Standard
5. SQL Queries
6. SQL Database Tables
7. SQL Injection
Code Like Pythonista
Beautifully made PPT.
Ref. http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
Image ref : https://pixabay.com/ko/ and https://morguefile.com/
licensed under a Creative Commons Attribution/Share-Alike (BY-SA) license.
The document discusses the skills needed for testing, including understanding code, interfaces, execution environments, logic, and technical writing. It then provides examples of testing a sort function by checking for exceptions with different input values and verifying the expected output. Finally, it discusses what needs to be known to implement and test a sort function, such as the sorting order, valid/invalid inputs, and intended behavior.
The document provides an overview of key Java concepts including development tools like JDK, JRE and JVM. It discusses primitive and non-primitive data types, operators, control statements, arrays, strings and string methods. Inner and nested classes as well as inheritance are also covered at a high level. The document serves as an introduction to core Java programming concepts.
This document provides an overview and agenda for a Java introduction presentation. It covers topics like the types of programming languages, what Java is and why it was developed, how to set up your environment to write Java programs, the basics of the Java language including variables, types, operators, methods, conditionals, loops, arrays, and object-oriented programming concepts. It also discusses how to write a first simple Java program and solve problems using Java.
This document discusses data structures and asymptotic analysis. It begins by defining key terminology related to data structures, such as abstract data types, algorithms, and implementations. It then covers asymptotic notations like Big-O, describing how they are used to analyze algorithms independently of implementation details. Examples are given of analyzing the runtime of linear search and binary search, showing that binary search has better asymptotic performance of O(log n) compared to linear search's O(n).
Who go Types in my Systems Programing!Jared Roesch
- Rust is a new systems programming language that pursues safety, concurrency, and performance. It was released in version 1.0 last week.
- The presentation will cover Rust's type system and core language features like ownership, borrowing, lifetimes, and traits which improve safety in systems programming. There will be exercises to apply the concepts hands-on.
This document provides an introduction to basic Python concepts including data types, control flow statements, and graphing with matplotlib. It includes examples of working with numbers, strings, lists, dictionaries, conditionals, loops, functions, histograms, and pie charts. The document demonstrates how to get started with Python interactive shells, perform basic math operations and string manipulations, use built-in data types, write functions, and create plots and charts.
- The document discusses Python programming concepts such as data types, variables, operators, and syntax. It provides examples of Python code for variables, comments, strings, numbers, and more.
- Python is a popular programming language used for web development, software development, mathematics, and more. It runs on different platforms and has a simple, readable syntax.
- Key features of Python include dynamic typing, automatic memory management, and an intuitive syntax that uses indentation rather than brackets.
Similar to Well Grounded Python Coding - Revision 1 (Day 1 Handouts) (20)
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxEduSkills OECD
Iván Bornacelly, Policy Analyst at the OECD Centre for Skills, OECD, presents at the webinar 'Tackling job market gaps with a skills-first approach' on 12 June 2024
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
1. 1
WELL-GROUNDED
PYTHON CODING
Worajedt Sitthidumrong
Class #1 - Dec 21-22, 2019
www.qython.io
Copyrights 2019 by Worajedt Sitthidumrong. For your Personal Uses Only.
2
BASIC
https://learnxinyminutes.com/docs/
python3/ (ภาษาไทยกำลังมาในไม่ช้า)
Pareto Principle
80:20
3
EX01 DATA TYPES & STATEMENT
Data types
•Basic [int, float, boolean, string, char]
•Complex [set, tuple, list, dict]
•type()
Coding Language
•Comment
•Assignment
•Expression
•Blocks (if, loop)
2. 4
EX01 DATA TYPES & STATEMENT (CONT.)
Equality
•Is Operator
•Assigned to
•==
•!=
Caution!
•Variable and naming
•Indents
•Common Errors
5
EX02 VIRTUAL ENVIRONMENT
Why you should use ‘virtual environment’?
•What is venv
•How to config and use venv in PyCharm
•How many of them?
•virtualenv
•conda
•pipenv
6
EX03 PACKAGE INSTALLATION
What is ‘pip’
•pip search ……
•pip install ……
•pip freeze > requirements.txt
•pip install requirements.txt
3. 7
MATH
Very primitive operators that you
must know how to use them.
+ - * / % // **
8
EX01 MATH CALC 1
Write a program that calculate ‘Area of Square, Rectangle, Triangle’
•Use this formulas [ w * w, w * h, 1/2 * b * h ]
•Note about integer or float calculation.
Write a program that calculate ‘VAT’
•Use this calculation [ taxed_price = price + ( 7% of price) ]
Rewrite them again with ‘input()’
•Rewrite all programs above with user’s input for [ w, h, b, price ]
9
EX02 MATH CALC 2 DIVISION
Write a program ‘Does it Odd?’
•Get one user input and show that it is an odd number or not
•Note modulus (%) may be helpful
Write a program ‘FizzBuzz’
•Get one user input and consider if it can be divided by 3 or
5 or both without remainder.
4. 10
EX03 MATH CALC 3 PARENTHESIS, ORDER
Consider this expressions
•print( 100-2/3^5 )
•print( (100-2)/3^5 )
•print( 100-(2/3)^5 )
•print( 100-2/(3^5) )
What make them different?
11
EX04 MATH CALC 4 ‘MATH MODULE’
Try this ‘math’ module by yourself
•math.pi
•math.pow()
•math.random()
Can you explain ‘random()’
12
STRING
What you mostly use for human
communication and presentation
String in many senses; list, chars
and know how to transform them
5. 13
EX01 ASCII, UNICODE • CHAR, STRING
Do you know ‘ASCII’ or ‘Unicode’ Character Code?
•What’s saved in computer when your text has ‘ABCD’ inside?
•Note try to find which text encoding inside your PyCharm files.
Find out more about ‘ASCII’ and ‘Unicode’ tables
•Non-printable characters. [ n, r, t ]
‘Char’ acter and ‘String’
•String made from characters.
14
EX02 STRING OPERATOR
What’s possible to calculate with ‘string’?
•‘concatenate’ or ‘plus’
•‘in’ & ‘not’
•‘multiply’ ? Really?
•len()
•upcase(), lowcase()
‘slice’ is BIGGGGGGGG
•REMEMBER THIS!! [ string[start:stop:step] ]string[start:stop:step]
‘slice’ is BIGGGGGGGG
15
EX03 STRING FORMAT
It’s better to use .format() than multiple plus operators
•‘The {} brown fox jumped over the lazy dog’.format(‘quick’)
•‘Only {0} lived for others is {0} {1}’.format(‘a life’,’worthwhile’}
•# - Albert Einstein
•‘Hi {name}, an announcement has been made from {teacher}, instructor
of {course} and 2 more courses.’
.format(
name=‘Worajedt’,
teacher=‘Holczer’,
course=‘Advanced Algorithms in Java, Data Structures in Java’
)
6. 16
EX04 STRING FORMAT USE CASE
•Can you create a program to print this medication label?
•Note : Use keywords to be placeholders instead of numeric
index
17
SYSTEM THEORY
Do you ever heard of..
Input-Process-Output or..
Garbage in, garbage out?
Learn more
Learn more
18
BASIC OF ‘SYSTEM THEORY’
Input Output
Process Feedback
7. 19
EX01 GRADING FUNCTION
Write a program that return grade from input score
•Grades are :
• Grade Score Range
A >= 80
B 70 - 79
C 60 - 69
D 50 = 59
F < 50
20
CONDITION
When we have information,
it let us ‘make decision’.
If-else, if-elif-else and
boolean algebra come in.
21
EX01 GRADING REVISIT
Enhance your grading system again with if-elif-else
•Is it a number ?
•Is it within range 0 - 100 ?
•Make your code readable
•Wrap main idea within
•if __name__ == ‘__main__’:
• xxxxx
• xxxxx
8. 22
EX02 FIZZBUZZ APP REVISIT
Enhance your FizzBuzz again with if-elif-else
•Is it a number ?
•Is it within range 0 - 100 ?
•Wrap the main logic within check_fizzbuxz()
•Make your code readable
•Wrap main idea within
•if __name__ == ‘__main__’:
• xxxxx
• xxxxx
23
Information can hold in a variable. But a variable can
hold more than one information. Ordered or
Unordered.
Set, Tuple, List and Dictionary.
All of these come with different kind of
parenthesizes.
COMPLEX DATATYPES
24
EX01 CREATE LIST VS TUPLELIST
What’s the different between ‘tuple’ and ‘list’ ?
•Tuple is Read Only & faster
•Both are ‘array’
•Both are ‘ordered list’
•Both are ‘zero-based index’
tp = (1,5,7,9) # create a tuple
li = [1,5,7,9] # create a list
9. 25
EX02 MODIFY LIST
List can be modified, so these are ways you can do with a list.
•Find size of list
•Pull data from each list
•Add more member(element)
•Remove member (one by one)
•Reverse all members
•Count a selected member
•Find index(position) of a member
•Find if list has this member
LIST
26
EX03 OPERATIONS
We can use some operations, check it out.
•Combine lists ( and tuple! )
•Unpack members to variables
LIST
27
EX04 SLICE
List has one thing you must practice, slicing the list
LIST
list[start:stop:step]
0 1 2 3 4 5 6 7 8
B U T T E R F L Y
-9 -8 -7 -6 -5 -4 -3 -2 -1
10. 28
EX05 LIST COMPREHENSION
List Comprehension helps you define members with condition(s)
•Create a list consists of members in a condition
•You can use condition to create members
•And map() object to help you modified members
•Also, you can use this comprehension with ‘tuple’
LIST
29
EX06 LIST OF LISTS (2D ARRAY)
Just a simple rules, list can have any types of its member. Even list.
•Try to create a simple data made from list of lists
•How can we replace the red location?
LIST
two_d_li = [
[1,3,5,7],
[2,4,6,8],
[5,0,5,0]
]
30
EX01 CREATE DICT
Unordered list of data that comes with pair of {key:value}
•They are paired { “key”: value }
•No ordered
•Access by ‘key’
•Can get a list of keys and a list of values
DICTIONARY
11. 31
EX02 MODIFY DICT
Dictionary can do mostly list can
•You can find if the key exists
•And avoid error with .get()
•Update value and append value
DICTIONARY
32
EX01 COMMON STRUCTURE
The most important and common structure of ‘database’
•1 Root key (option)
•Array (list) at root level
•Consists of dictionary (same structure) as the list members
Database query result, JSON API result are the most common format like this.
LIST OF DICTIONARY
33
EX02 CREATE A JSON DATA
Learn how to create a JSON data
•What’s JSON?
•Try to create a JSON data from your experience
LIST OF DICTIONARY
12. 34
FOR LOOP
Bunch of information may require the
same set of instructions on them.
For-loops have many ways to deal
with each kind of data types.
35
EX01 FOR LOOP WITH COUNTER
‘for in’ LIST
If we deal with ‘ordered list’ , we can use ‘for in’
•for animal in ["dog", "cat", "mouse"]:
•for i in range(4):
•list = ["dog", "cat", "mouse"]
•for i, value in enumerate(list):
• print(i, value)
•x = 0
•while x < 4:
• print(x)
• x += 1 # or x = x+1
36
EX02 FOR + IF ELSE FIZZBUZZ REVISIT
‘for in’ LIST
Can you modify your FizzBuzz?
•Create a list of number, may be from range()
•Then apply fizzbuzz() for every items
•Print the output
13. 37
EX01 FOOTBALL PLAYERS
‘for each’ DICT
Actually, there is NO ‘for each’ in Python.
•a_dict = {'one': 1, 'two': 2, 'thee': 3, 'four': 4}
•new_dict = {}
•for key, value in a_dict.items():
• new_dict[value] = key
•print(new_dict)
•Now create a dict of football players and iterates over them.
38
EX02 FOR + IF ELSE
‘for each’ DICT
You can apply condition to each loop
From the dict of football players, now iterates over them,
only who are older than 30 yrs
39
EX01-10 : CONTINUOUS EXERCISES
RUNNERS
Use the exercises 01-10 about runners,
complete them all!
14. 40
PYCHARM IDE
Do you really know how to use
PyCharm IDE?
I bet you’re not. Not even close.
41
CODING THE RIGHT WAY
Design how your program should work.
•Start from main()
•Write something readable and not too complex
•Create pseudo function and variable then refactor to real one
•Alt+Enter | Opt+Return is god send!
•Migrate each of them to the right files/modules
•Alt+Enter | Opt+Return is god send!
42
TEXT EDITING
To learn a good text editor, learn about this
•Cursor movements
•Multi-Cursor
•Column Selection Mode
•Find and Replace
•Regular-Expression ( an alien language that save your @$$)
15. 43
REFACTORING
Refactoring features in PyCharm you should know
•(Watch the demo in class)
44
RUNNING & DEBUGGING
In PyCharm you can set many running configurations.
•(Watch the demo in class)
PyCharm debug features is much more readable, let’s do it!
•(Watch the demo in class)
45
Do you know when your code works?
How you measure it?
Are you sure your measure tool working correctly?
If you’re sure, how long it can be working properly?
TDD techniques and testing frameworks help you sleep
better.
TEST DRIVEN DEVELOPMENT
(TDD)
16. 46
WHAT IS TDD?
• Do you know when your code works?
• How you measure it?
• Are you sure your measure tool working
correctly?
• If you’re sure, how long it can be working
properly?
47
48
‘pytest’
‘pytest’ is one of the best testing library in Python
• Almost no configuration
• Fast running
• Many extension, even BDD (Behavior-Driven Development)
• Integrate with PyCharm (Professional)
Time to demo !
17. 49
EX01 TDD CALCULATOR
EX02 TDD AREA CALC
EX03 TDD VAT CALC
50
WORKSHOP 01 TDD :
FIND A FREE RANGE
51
WORKSHOP 02 TDD :
FIND THE RIGHT EAN13 BARCODE CHECK DIGIT
https://www.gs1.org/services/how-calculate-check-digit-manually
The following table gives an example to illustrate how a GTIN-13 Check Digit is calculated:
19. 55
FILE
Any of you have never worked with file?
Since you are all have worked with
it. You better know how to work
with it correctly.
None
56
FILE MODES IN PYTHON
FILE
Mode Description
‘r’ This is the default mode. It Opens file for reading.
‘w’
This Mode Opens file for writing. If file does not exist, it creates a new
file. If file exists it truncates the file.
‘x’ Creates a new file. If file already exists, the operation fails.
‘a’
Open file in append mode.
If file does not exist, it creates a new file.
’t’ This is the default mode. It opens in text mode.
‘b’ This opens in binary mode.
‘+’ This will open a file for reading and writing (updating)
57
EX01 OPEN AND READ A FILE
FILE
Python use concept of open and close file like we had in C, Java
• 1) Open the file in Read mode with open()
• 2) We use the mode function in the code to check that the file is
in open mode. If yes, we proceed ahead
• 3) Use f.read() or f.readline() to read file data and store it in
variable content
• 4) print contents
20. 58
EX02 WRITE A FILE CONTENT
FILE
Python use concept of open and close file like we had in C, Java
• 1) Open the file in Write/Append mode with open()
• 2) Create some content and f.write(‘content inside’)
• 3) Use f.close() to close the file (save)
• 4) To Append, process is the same except open() with ‘a+'
59
EX03 READ / WRITE THE MODERN WAY
FILE
Python 3 can use ‘with’ block to read/write file
# Writing to a file
contents = {"aa": 12, "bb": 21}
with open("myfile2.txt", "w+") as file:
file.write(json.dumps(contents)) # writes an object to a file
# Reading from a file
with open('myfile1.txt', "r+") as file:
contents = file.read() # reads a string from a file
print(contents)
# print: {"aa": 12, "bb": 21}
60
CSV FILE
When we process something, data input or
output may be any formats. CSV is one of the
primitive data since the early age of computer.
And it still very important in this Big
Data Era.
21. 61
EX01 READ CSVCSV
Programming language Designed by Appeared Extension
Python Guido van Rossum 1991 .py
Java James Gosling 1995 .java
C++ Bjarne Stroustrup 1983 .cpp
• 1) import csv
• 2) Open the file in ‘rt' mode with open()
• 3) Use csv.reader() to read the file by Row
• 4) Use csv.DictReader() to read each row, column as Dictionary
62
EX02 WRITE CSVCSV
• 1) import csv
• 2) Open the file in Write/Append mode with open()
• 3) Use writer = csv.writer(file, delimiter=',', quotechar='"',
quoting=csv.QUOTE_MINIMAL)
• 4) writer.writerow(['Programming language', 'Designed by', 'Appeared',
'Extension'])
63
DATABASE
While working with CSV is pretty easy. It’s still very basic in
terms of relationship and connection between each other
entities.
Relational Database Management System (RMDB) and
Structured Query Language (SQL) seems like the
backbone of data management system.
“No matter what it takes. Learn it, you must.”
– Master Yoda
22. 64
BASIC OF RELATIONAL DATABASE Definitions
• Database
• Table
• Field (Column)
• Record (Row)
• Primary Key (PK)
• Foreign Key (FK)
• One to Many
• Many to Many
65
SNIPPETS
Learn How To Create Snippets
To Save Your Time
Of programmers don’t
know How to Create
Snippets.
Is the time you may save writing
code/fix spelling/pull your hair
by using Snippets.
90%
30%
66
SQL LANGUAGE WITH SQLITE
import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to a SQLite database """
conn = None
try:
conn = sqlite3.connect(db_file)
print(sqlite3.version)
except Error as e:
print(e)
finally:
if conn:
conn.close()
23. 67
SQL LANGUAGE WITH SQLITE (CONT)
. . . . .
conn = None
try:
conn = sqlite3.connect(db_file)
print(sqlite3.version)
except Error as e:
print(e)
finally:
if conn:
conn.close()
if __name__ == '__main__':
create_connection(r"C:sqlitedbpythonsqlite.db")
68
EX01 MANIPULATE TABLE
-- tasks table
-- sql_create_tasks_table =
CREATE TABLE IF NOT EXISTS tasks (
id integer PRIMARY KEY,
name text NOT NULL,
priority integer,
project_id integer NOT NULL,
status_id integer NOT NULL,
begin_date text NOT NULL,
end_date text NOT NULL,
FOREIGN KEY (project_id)
REFERENCES projects (id)
);
-- projects table
-- sql_create_projects_table =
CREATE TABLE IF NOT EXISTS projects (
id integer PRIMARY KEY,
name text NOT NULL,
begin_date text,
end_date text
);
69
EX01 MANIPULATE TABLE (CONT)
def create_table(conn, create_table_sql):
""" create a table from the create_table_sql statement
:param conn: Connection object
:param create_table_sql: a CREATE TABLE statement
:return:
"""
try:
c = conn.cursor()
c.execute(create_table_sql)
except Error as e:
print(e)
24. 70
EX01 MANIPULATE TABLE (CONT)
def main():
database = r"C:sqlitedbpythonsqlite.db"
sql_create_projects_table = """ CREATE TABLE IF NOT EXISTS projects (
sql_create_tasks_table = """CREATE TABLE IF NOT EXISTS tasks (
# create a database connection
conn = create_connection(database)
# create tables
if conn is not None:
# create projects table
create_table(conn, sql_create_projects_table)
# create tasks table
create_table(conn, sql_create_tasks_table)
else:
print("Error! cannot create the database connection.")
71
EX02 SELECT DATA
def select_all_tasks(conn):
"""
Query all rows in the tasks table
:param conn: the Connection object
:return:
"""
cur = conn.cursor()
cur.execute("SELECT * FROM tasks")
rows = cur.fetchall()
for row in rows:
print(row)
72
EX02 SELECT DATA (CONT)
def select_task_by_priority(conn, priority):
"""
Query tasks by priority
:param conn: the Connection object
:param priority:
:return:
"""
cur = conn.cursor()
cur.execute("SELECT * FROM tasks WHERE priority=?", (priority,))
rows = cur.fetchall()
for row in rows:
print(row)
25. 73
EX03 INSERT DATA
def create_task(conn, task):
"""
Create a new task
:param conn:
:param task:
:return:
"""
sql = ''' INSERT INTO tasks(name,priority,status_id,project_id,begin_date,end_date)
VALUES(?,?,?,?,?,?) '''
cur = conn.cursor()
cur.execute(sql, task)
return cur.lastrowid
74
EX03 INSERT DATA (CONT)
def main():
database = r"C:sqlitedbpythonsqlite.db"
# create a database connection
conn = create_connection(database)
with conn:
# create a new project
project = ('Cool App with SQLite & Python', '2015-01-01', '2015-01-30');
project_id = create_project(conn, project)
# tasks
task_1 = ('Analyze the requirements of the app', 1, 1, project_id,
'2015-01-01', '2015-01-02')
task_2 = ('Confirm with user about the top requirements', 1, 1, project_id,
'2015-01-03', '2015-01-05')
# create tasks
create_task(conn, task_1)
create_task(conn, task_2)
75
EX04 UPDATE DATA
def update_task(conn, task):
"""
update priority, begin_date, and end date of a task
:param conn:
:param task:
:return: project id
"""
sql = ''' UPDATE tasks
SET priority = ? ,
begin_date = ? ,
end_date = ?
WHERE id = ?'''
cur = conn.cursor()
cur.execute(sql, task)
conn.commit()
26. 76
EX04 UPDATE DATA (CONT)
def main():
database = r"C:sqlitedbpythonsqlite.db"
# create a database connection
conn = create_connection(database)
with conn:
update_task(conn, (2, '2015-01-04', '2015-01-06', 2))
77
EX05 DELETE DATA
def delete_task(conn, id):
"""
Delete a task by task id
:param conn: Connection to the
SQLite database
:param id: id of the task
:return:
"""
sql = 'DELETE FROM tasks WHERE id=?'
cur = conn.cursor()
cur.execute(sql, (id,))
conn.commit()
def main():
database = r"C:sqlitedbpythonsqlite.db"
# create a database connection
conn = create_connection(database)
with conn:
delete_task(conn, 2);
# delete_all_tasks(conn);