SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
國立臺北護理健康大學 NTUHS
Python Introduction
Orozco Hsu
2021-11-01
1
About me
• Education
• NCU (MIS)、NCCU (CS)
• Work Experience
• Telecom big data Innovation
• AI projects
• Retail marketing technology
• User Group
• TW Spark User Group
• TW Hadoop User Group
• Taiwan Data Engineer Association Director
• Research
• Big Data/ ML/ AIOT/ AI Columnist
2
Tutorial
Content
3
Python Programming Basics for Beginners
Homework
Brief introduction
Python basic tutorials
Code
• Download code
• https://github.com/orozcohsu/ntunhs_2021.git
• Folder
• 20211101_inter_master
4
What can Python do?
•Console application
•Desktop application
•Web application
•Mobile application
•Machine Learning
•Data Science
•IOT application
•And many more …
5
Python version
• Python 0.9.0 - February 20, 1991
• Python 0.9.1 - 1991
• Python 0.9.2 - 1991
• Python 1.0 - January 1994
• Python 1.2 - April 10, 1995
• Python 1.3 - October 12, 1995
• Python 1.4 - October 25, 1996
• Python 1.5 - December 31, 1997
• Python 1.6 - September 5, 2000
• Python 2.0 - October 16, 2000
• Python 2.1 - April 15, 2001
• Python 2.2 - December 21, 2001
• Python 2.3 - July 29, 2003
• Python 2.4 - November 30, 2004
• Python 2.5 - September 19, 2006
• Python 2.6 - October 1, 2008
• Python 2.7 - July 3, 2010
6
Python 3.0 - December 3, 2008
Python 3.1 - June 27, 2009
Python 3.2 - February 20, 2011
Python 3.3 - September 29, 2012
Python 3.4 - March 16, 2014
Python 3.5 - September 13, 2015
Python 3.6 - December 23, 2016
Python 3.7 - June 27, 2018
Python 3.8 - October 19, 2019
Python 3.9 - October 05, 2020
Python 3.10 - October 04, 2021
Python features
• Easy to learn, fast to develop
• The grammar is easy to learn and understand, suitable for beginners,
and can accelerate the learning of other languages.
• Several lines of code can be used to complete complex tasks.
• Cross-platform (cross-operating system)
• Powerful standard library (internal modeling group)
• Python built-in standard function library, providing a wide range of
internal modeling groups, such as: text
7
Life is short, you need Python.
• Python classic third-party package
• Web framework: Django, Flask, Pyramid, web2py
• GUI development: PyQt, Tkinter, wxPython App development: kivy
• Crawler: Scrapy, selenium, beautifulsoup
• Data science: numpy, scipy, matplotlib, pandas Machine learning:
keras, tensorflow
• Python official kit website: Pypi
8
Third-party kit
• Python third-party kit recommendation website
• https://python.libhunt.com/categories?fbclid=IwAR3NRxa8sCBaK-
ndsx6D5fkYbQOny1Ya2qRlpD-Z6cRJZi_0kJ-Ff4xKLZw
• https://awesome-python.com/
9
Programming language popularity ranking
10
Python Programming Basics for Beginners
• Install Anaconda for Windows (Individual Edition)
• https://www.anaconda.com/products/individual
11
Python Programming Basics for Beginners
• print() function
• The print() function in Python is used to print a specified message on the
screen. The print command in Python prints strings or objects which are
converted to a string while printing on a screen.
• print blank lines
• Sometimes you need to print one blank line in your Python program.
Following is an example to perform this task using Python print format.
12
python_exercise_01.ipynb
Python Programming Basics for Beginners
• How to Declare and use a Variable
• Re-declare a Variable
• Python String Concatenation and Variable
• Python Variable Types: Local & Global
• Delete a variable
13
Python Data Structure
• Python TUPLE
• Tuple Matching in Python is a method of grouping the tuples by matching the
second element in the tuples. It is achieved by using a dictionary by checking
the second element in each tuple in python programming. However, we can
make new tuples by taking portions of existing tuples.
• Tuple packing and unpacking.
• Comparing tuples.
• Using tuples as keys in dictionaries.
• Deleting Tuples.
• Slicing of Tuple.
14
Python Data Structure
• Advantages of tuple over list
• Iterating through tuple is faster than with list, since tuples are immutable.
• Tuples that consist of immutable elements can be used as key for dictionary,
which is not possible with list
• If you have data that is immutable, implementing it as tuple will guarantee
that it remains write-protected
15
Python Data Structure
• Try
• To perform different task, tuple allows you to use many built-in functions like
all(), any(), enumerate(), max(), min(), sorted(), len()
16
Python Dictionary
• A Dictionary in Python is the unordered and changeable collection of
data values that holds key-value pairs.
• Each key-value pair in the dictionary maps the key to its associated
value making it more optimized.
• A Dictionary in python is declared by enclosing a comma-separated
list of key-value pairs using curly braces{}.
• Updating Dictionary
• Delete Keys from the dictionary
• Dictionary items() Method
• Sorting the Dictionary
• Merging Dictionaries
17
Python Dictionary
• The ** is called Kwargs in Python, and it will work with Python version
3.5+. Using **
• We can merge two dictionaries, and it will return the merged
dictionary.
18
Python Dictionary
• Dictionary is one of the important data types available in Python. The
data in a dictionary is stored as a key/value pair. It is separated by a
colon(:), and the key/value pair is separated by comma(,).
• Python Dictionary Append
• Accessing elements of a dictionary
• Deleting Element(s) from dictionary using pop() method
• Appending element(s) to a dictionary
• Updating existing element(s) in a dictionary
• Insert a dictionary into another dictionary
19
Python Operators
• Logical Operators in Python are used to perform logical operations on
the values of variables. The value is either true or false. We can figure
out the conditions by the result of the truth values. There are mainly
three types of logical operators in python : logical AND, logical OR and
logical NOT. Operators are represented by keywords or special
characters.
• Arithmetic Operators
• Comparison Operators
• Python Assignment Operators
• Logical Operators or Bitwise Operators
• Membership Operators
• Identity Operators
20
Python Arrays
• A Python Array is a collection of common type of data structures
having elements with same data type. It is used to store collections of
data. In Python programming, an arrays are handled by the “array”
module. If you create arrays using the array module, elements of the
array must be of the same numeric type.
• insert elements
• modify elements
• pop an element from Array
• delete elements
• Search and get the index of a value in an Array
• Reverse an Array
• Traverse an Array
21
Python Arrays
• What is the difference of array and list
• Data type is different
• array: all elements must be all the same type
• list (linked-list): all elements can be multiple data types
22
Python Conditional Loops
• Conditional Statement in Python perform different computations or
actions depending on whether a specific Boolean constraint evaluates
to true or false. Conditional statements are handled by IF statements
in Python.
• Python if Statement
• else condition
• elif condition
• conditional statement with minimal code
• Nested if Statement
• Switch Case Statement
23
Python For & While Loops
• What is Loop?
• Loops can execute a block of code number of times until a certain
condition is met. Their usage is fairly common in programming. Unlike
other programming language that have For Loop, while loop, dowhile, etc.
• What is For Loop?
• For loop is used to iterate over elements of a sequence. It is often used
when you have a piece of code which you want to repeat “n” number of
time.
• What is While Loop?
• While Loop is used to repeat a block of code. Instead of running the code
block once, It executes the code block multiple times until a certain
condition is met.
24
Python break, continue, pass statements
• The break statement takes care of terminating the loop in which it is
used. If the break statement is used inside nested loops, the current
loop is terminated, and the flow will continue with the code followed
that comes after the loop.
• break statement
• break statement inside while-loop
• break Statement inside nested loops
• The continue statement skips the code that comes after it, and the
control is passed back to the start for the next iteration.
• Continue inside for-loop
25
Python break, continue, pass statements
• Python pass statement is used as a placeholder inside loops,
functions, class, if-statement that is meant to be implemented later.
• pass
• pass statement inside the loop
26
Python OOPs
• OOPs in Python is a programming approach that focuses on using
objects and classes as same as other general programming languages.
The objects can be any real-world entities. Python allows developers
to develop applications using the OOPs approach with the major
focus on code reusability. It is very easy to create classes and objects
in Python.
• Inheritance works
• Constructors
27
String
• In Python everything is object and string are an object too. Python string
can be created simply by enclosing characters in the double quote.
• String replace()
• Changing upper and lower case strings
• join function
• Reversing String
• Split Strings
• string format()
• class with format()
• dictionary with format()
• Padding Variable Substitutions
• find() using start and end arguments
28
function
• Python main function is a starting point of any program. When the
program is run, the python interpreter runs the code sequentially.
Main function is executed only when it is run as a Python program. It
will not run the main function if it imported as a module.
• __name__ variable and Python Module
• defile function
29
lambda function
• A Lambda Function in Python programming is an anonymous function
or a function having no name. It is a small and restricted function
having no more than one line. Just like a normal function, a Lambda
function can have multiple arguments with one expression.
• lambdas in filter()
• lambdas in map()
• lambdas in reduce()
• abs(), round(), range(), map()
30
Generators
• Generators are functions that return an iterable generator object.
• The values from the generator object are fetched one at a time
instead of the full list together and hence to get the actual values you
can use a for-loop, using next() or list() method.
• read the values from the generator
31
Queue
• A queue is a container that holds data.
• The data that is entered first will be removed first, and hence a queue
is also called First in First Out (FIFO).
• Add and item in a queue
• Remove an item from the queue
• Last In First Out queue
• Remove an item from the queue
• Add more than 1 item in a queue
• Add and item in a LIFO queue
32
counter, enumerate
• Python Counter takes in input a list, tuple, dictionary, string, which
are all iterable objects, and it will give you output that will have the
count of each element.
• counter()
• enumerate()
• enumerate a dictionary
33
type() and isinstance()
• Python has a built-in function called type() that helps you find the
class type of the variable given as input
34
Homework Assignment
• Use python range function to output nine-nine multiplication table
• Use python output Fibonacci-Series by using generators and yield
function
• Output: Fibonacci-Series: [0,1,1,2,3,5,8]
• Sorting queue
35

Más contenido relacionado

La actualidad más candente

Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners Sujith Kumar
 
Python Introduction | JNTUA | R19 | UNIT 1
Python Introduction | JNTUA | R19 | UNIT 1 Python Introduction | JNTUA | R19 | UNIT 1
Python Introduction | JNTUA | R19 | UNIT 1 FabMinds
 
Type hints in python & mypy
Type hints in python & mypyType hints in python & mypy
Type hints in python & mypyAnirudh
 
Python Crash Course
Python Crash CoursePython Crash Course
Python Crash CourseHaim Michael
 
Python presentation
Python presentationPython presentation
Python presentationgaganapponix
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshopamptiny
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its ApplicationsAbhijeet Singh
 
Python Summer Internship
Python Summer InternshipPython Summer Internship
Python Summer InternshipAtul Kumar
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1Ahmet Bulut
 
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWPYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWEditorIJAERD
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on pythonShubham Yadav
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAMaulik Borsaniya
 
Why Python?
Why Python?Why Python?
Why Python?Adam Pah
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask TrainingJanBask Training
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming pptismailmrribi
 
Python: the Project, the Language and the Style
Python: the Project, the Language and the StylePython: the Project, the Language and the Style
Python: the Project, the Language and the StyleJuan-Manuel Gimeno
 

La actualidad más candente (20)

Python final ppt
Python final pptPython final ppt
Python final ppt
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Python Introduction | JNTUA | R19 | UNIT 1
Python Introduction | JNTUA | R19 | UNIT 1 Python Introduction | JNTUA | R19 | UNIT 1
Python Introduction | JNTUA | R19 | UNIT 1
 
Type hints in python & mypy
Type hints in python & mypyType hints in python & mypy
Type hints in python & mypy
 
Python Crash Course
Python Crash CoursePython Crash Course
Python Crash Course
 
Python for All
Python for All Python for All
Python for All
 
Python presentation
Python presentationPython presentation
Python presentation
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshop
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
 
Python Summer Internship
Python Summer InternshipPython Summer Internship
Python Summer Internship
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1
 
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWPYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
 
Research paper on python by Rj
Research paper on python by RjResearch paper on python by Rj
Research paper on python by Rj
 
Why Python?
Why Python?Why Python?
Why Python?
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask Training
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Python: the Project, the Language and the Style
Python: the Project, the Language and the StylePython: the Project, the Language and the Style
Python: the Project, the Language and the Style
 
Python and data analytics
Python and data analyticsPython and data analytics
Python and data analytics
 

Similar a Python indroduction

Python presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharPython presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharUttamKumar617567
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh MalothBhavsingh Maloth
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Mohan Arumugam
 
Python for katana
Python for katanaPython for katana
Python for katanakedar nath
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonMohammed Rafi
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programmingChetan Giridhar
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdfShivamKS4
 
Summer Training Project On Python Programming
Summer Training Project On Python ProgrammingSummer Training Project On Python Programming
Summer Training Project On Python ProgrammingKAUSHAL KUMAR JHA
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxHassanShah396906
 
Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptxVinay Chowdary
 

Similar a Python indroduction (20)

Python presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharPython presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, Bihar
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptx
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)
 
Python for katana
Python for katanaPython for katana
Python for katana
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programming
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdf
 
Summer Training Project On Python Programming
Summer Training Project On Python ProgrammingSummer Training Project On Python Programming
Summer Training Project On Python Programming
 
Python intro
Python introPython intro
Python intro
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptx
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
 
Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptx
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
 
Training python (new Updated)
Training python (new Updated)Training python (new Updated)
Training python (new Updated)
 
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdfClass_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
 

Más de FEG

Sequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdfSequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdfFEG
 
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdfFEG
 
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdfFEG
 
Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318FEG
 
2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practicesFEG
 
2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratchFEG
 
2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratchFEG
 
2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratchFEG
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_RulesFEG
 
202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)FEG
 
202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis VisualizationFEG
 
Transfer Learning (20230516)
Transfer Learning (20230516)Transfer Learning (20230516)
Transfer Learning (20230516)FEG
 
Image Classification (20230411)
Image Classification (20230411)Image Classification (20230411)
Image Classification (20230411)FEG
 
Google CoLab (20230321)
Google CoLab (20230321)Google CoLab (20230321)
Google CoLab (20230321)FEG
 
Supervised Learning
Supervised LearningSupervised Learning
Supervised LearningFEG
 
UnSupervised Learning Clustering
UnSupervised Learning ClusteringUnSupervised Learning Clustering
UnSupervised Learning ClusteringFEG
 
Data Visualization in Excel
Data Visualization in ExcelData Visualization in Excel
Data Visualization in ExcelFEG
 
6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdfFEG
 
5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdfFEG
 
4_Regression_analysis.pdf
4_Regression_analysis.pdf4_Regression_analysis.pdf
4_Regression_analysis.pdfFEG
 

Más de FEG (20)

Sequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdfSequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdf
 
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
 
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
 
Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318
 
2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices
 
2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch
 
2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch
 
2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules
 
202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)
 
202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization
 
Transfer Learning (20230516)
Transfer Learning (20230516)Transfer Learning (20230516)
Transfer Learning (20230516)
 
Image Classification (20230411)
Image Classification (20230411)Image Classification (20230411)
Image Classification (20230411)
 
Google CoLab (20230321)
Google CoLab (20230321)Google CoLab (20230321)
Google CoLab (20230321)
 
Supervised Learning
Supervised LearningSupervised Learning
Supervised Learning
 
UnSupervised Learning Clustering
UnSupervised Learning ClusteringUnSupervised Learning Clustering
UnSupervised Learning Clustering
 
Data Visualization in Excel
Data Visualization in ExcelData Visualization in Excel
Data Visualization in Excel
 
6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf
 
5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf
 
4_Regression_analysis.pdf
4_Regression_analysis.pdf4_Regression_analysis.pdf
4_Regression_analysis.pdf
 

Último

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 

Último (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 

Python indroduction

  • 2. About me • Education • NCU (MIS)、NCCU (CS) • Work Experience • Telecom big data Innovation • AI projects • Retail marketing technology • User Group • TW Spark User Group • TW Hadoop User Group • Taiwan Data Engineer Association Director • Research • Big Data/ ML/ AIOT/ AI Columnist 2
  • 3. Tutorial Content 3 Python Programming Basics for Beginners Homework Brief introduction Python basic tutorials
  • 4. Code • Download code • https://github.com/orozcohsu/ntunhs_2021.git • Folder • 20211101_inter_master 4
  • 5. What can Python do? •Console application •Desktop application •Web application •Mobile application •Machine Learning •Data Science •IOT application •And many more … 5
  • 6. Python version • Python 0.9.0 - February 20, 1991 • Python 0.9.1 - 1991 • Python 0.9.2 - 1991 • Python 1.0 - January 1994 • Python 1.2 - April 10, 1995 • Python 1.3 - October 12, 1995 • Python 1.4 - October 25, 1996 • Python 1.5 - December 31, 1997 • Python 1.6 - September 5, 2000 • Python 2.0 - October 16, 2000 • Python 2.1 - April 15, 2001 • Python 2.2 - December 21, 2001 • Python 2.3 - July 29, 2003 • Python 2.4 - November 30, 2004 • Python 2.5 - September 19, 2006 • Python 2.6 - October 1, 2008 • Python 2.7 - July 3, 2010 6 Python 3.0 - December 3, 2008 Python 3.1 - June 27, 2009 Python 3.2 - February 20, 2011 Python 3.3 - September 29, 2012 Python 3.4 - March 16, 2014 Python 3.5 - September 13, 2015 Python 3.6 - December 23, 2016 Python 3.7 - June 27, 2018 Python 3.8 - October 19, 2019 Python 3.9 - October 05, 2020 Python 3.10 - October 04, 2021
  • 7. Python features • Easy to learn, fast to develop • The grammar is easy to learn and understand, suitable for beginners, and can accelerate the learning of other languages. • Several lines of code can be used to complete complex tasks. • Cross-platform (cross-operating system) • Powerful standard library (internal modeling group) • Python built-in standard function library, providing a wide range of internal modeling groups, such as: text 7
  • 8. Life is short, you need Python. • Python classic third-party package • Web framework: Django, Flask, Pyramid, web2py • GUI development: PyQt, Tkinter, wxPython App development: kivy • Crawler: Scrapy, selenium, beautifulsoup • Data science: numpy, scipy, matplotlib, pandas Machine learning: keras, tensorflow • Python official kit website: Pypi 8
  • 9. Third-party kit • Python third-party kit recommendation website • https://python.libhunt.com/categories?fbclid=IwAR3NRxa8sCBaK- ndsx6D5fkYbQOny1Ya2qRlpD-Z6cRJZi_0kJ-Ff4xKLZw • https://awesome-python.com/ 9
  • 11. Python Programming Basics for Beginners • Install Anaconda for Windows (Individual Edition) • https://www.anaconda.com/products/individual 11
  • 12. Python Programming Basics for Beginners • print() function • The print() function in Python is used to print a specified message on the screen. The print command in Python prints strings or objects which are converted to a string while printing on a screen. • print blank lines • Sometimes you need to print one blank line in your Python program. Following is an example to perform this task using Python print format. 12 python_exercise_01.ipynb
  • 13. Python Programming Basics for Beginners • How to Declare and use a Variable • Re-declare a Variable • Python String Concatenation and Variable • Python Variable Types: Local & Global • Delete a variable 13
  • 14. Python Data Structure • Python TUPLE • Tuple Matching in Python is a method of grouping the tuples by matching the second element in the tuples. It is achieved by using a dictionary by checking the second element in each tuple in python programming. However, we can make new tuples by taking portions of existing tuples. • Tuple packing and unpacking. • Comparing tuples. • Using tuples as keys in dictionaries. • Deleting Tuples. • Slicing of Tuple. 14
  • 15. Python Data Structure • Advantages of tuple over list • Iterating through tuple is faster than with list, since tuples are immutable. • Tuples that consist of immutable elements can be used as key for dictionary, which is not possible with list • If you have data that is immutable, implementing it as tuple will guarantee that it remains write-protected 15
  • 16. Python Data Structure • Try • To perform different task, tuple allows you to use many built-in functions like all(), any(), enumerate(), max(), min(), sorted(), len() 16
  • 17. Python Dictionary • A Dictionary in Python is the unordered and changeable collection of data values that holds key-value pairs. • Each key-value pair in the dictionary maps the key to its associated value making it more optimized. • A Dictionary in python is declared by enclosing a comma-separated list of key-value pairs using curly braces{}. • Updating Dictionary • Delete Keys from the dictionary • Dictionary items() Method • Sorting the Dictionary • Merging Dictionaries 17
  • 18. Python Dictionary • The ** is called Kwargs in Python, and it will work with Python version 3.5+. Using ** • We can merge two dictionaries, and it will return the merged dictionary. 18
  • 19. Python Dictionary • Dictionary is one of the important data types available in Python. The data in a dictionary is stored as a key/value pair. It is separated by a colon(:), and the key/value pair is separated by comma(,). • Python Dictionary Append • Accessing elements of a dictionary • Deleting Element(s) from dictionary using pop() method • Appending element(s) to a dictionary • Updating existing element(s) in a dictionary • Insert a dictionary into another dictionary 19
  • 20. Python Operators • Logical Operators in Python are used to perform logical operations on the values of variables. The value is either true or false. We can figure out the conditions by the result of the truth values. There are mainly three types of logical operators in python : logical AND, logical OR and logical NOT. Operators are represented by keywords or special characters. • Arithmetic Operators • Comparison Operators • Python Assignment Operators • Logical Operators or Bitwise Operators • Membership Operators • Identity Operators 20
  • 21. Python Arrays • A Python Array is a collection of common type of data structures having elements with same data type. It is used to store collections of data. In Python programming, an arrays are handled by the “array” module. If you create arrays using the array module, elements of the array must be of the same numeric type. • insert elements • modify elements • pop an element from Array • delete elements • Search and get the index of a value in an Array • Reverse an Array • Traverse an Array 21
  • 22. Python Arrays • What is the difference of array and list • Data type is different • array: all elements must be all the same type • list (linked-list): all elements can be multiple data types 22
  • 23. Python Conditional Loops • Conditional Statement in Python perform different computations or actions depending on whether a specific Boolean constraint evaluates to true or false. Conditional statements are handled by IF statements in Python. • Python if Statement • else condition • elif condition • conditional statement with minimal code • Nested if Statement • Switch Case Statement 23
  • 24. Python For & While Loops • What is Loop? • Loops can execute a block of code number of times until a certain condition is met. Their usage is fairly common in programming. Unlike other programming language that have For Loop, while loop, dowhile, etc. • What is For Loop? • For loop is used to iterate over elements of a sequence. It is often used when you have a piece of code which you want to repeat “n” number of time. • What is While Loop? • While Loop is used to repeat a block of code. Instead of running the code block once, It executes the code block multiple times until a certain condition is met. 24
  • 25. Python break, continue, pass statements • The break statement takes care of terminating the loop in which it is used. If the break statement is used inside nested loops, the current loop is terminated, and the flow will continue with the code followed that comes after the loop. • break statement • break statement inside while-loop • break Statement inside nested loops • The continue statement skips the code that comes after it, and the control is passed back to the start for the next iteration. • Continue inside for-loop 25
  • 26. Python break, continue, pass statements • Python pass statement is used as a placeholder inside loops, functions, class, if-statement that is meant to be implemented later. • pass • pass statement inside the loop 26
  • 27. Python OOPs • OOPs in Python is a programming approach that focuses on using objects and classes as same as other general programming languages. The objects can be any real-world entities. Python allows developers to develop applications using the OOPs approach with the major focus on code reusability. It is very easy to create classes and objects in Python. • Inheritance works • Constructors 27
  • 28. String • In Python everything is object and string are an object too. Python string can be created simply by enclosing characters in the double quote. • String replace() • Changing upper and lower case strings • join function • Reversing String • Split Strings • string format() • class with format() • dictionary with format() • Padding Variable Substitutions • find() using start and end arguments 28
  • 29. function • Python main function is a starting point of any program. When the program is run, the python interpreter runs the code sequentially. Main function is executed only when it is run as a Python program. It will not run the main function if it imported as a module. • __name__ variable and Python Module • defile function 29
  • 30. lambda function • A Lambda Function in Python programming is an anonymous function or a function having no name. It is a small and restricted function having no more than one line. Just like a normal function, a Lambda function can have multiple arguments with one expression. • lambdas in filter() • lambdas in map() • lambdas in reduce() • abs(), round(), range(), map() 30
  • 31. Generators • Generators are functions that return an iterable generator object. • The values from the generator object are fetched one at a time instead of the full list together and hence to get the actual values you can use a for-loop, using next() or list() method. • read the values from the generator 31
  • 32. Queue • A queue is a container that holds data. • The data that is entered first will be removed first, and hence a queue is also called First in First Out (FIFO). • Add and item in a queue • Remove an item from the queue • Last In First Out queue • Remove an item from the queue • Add more than 1 item in a queue • Add and item in a LIFO queue 32
  • 33. counter, enumerate • Python Counter takes in input a list, tuple, dictionary, string, which are all iterable objects, and it will give you output that will have the count of each element. • counter() • enumerate() • enumerate a dictionary 33
  • 34. type() and isinstance() • Python has a built-in function called type() that helps you find the class type of the variable given as input 34
  • 35. Homework Assignment • Use python range function to output nine-nine multiplication table • Use python output Fibonacci-Series by using generators and yield function • Output: Fibonacci-Series: [0,1,1,2,3,5,8] • Sorting queue 35