This document provides an introduction and overview of Python for data science and machine learning. It covers basics of Python including what Python is, its features, why it is useful for data science. It also discusses installing Python, using the IDLE and Jupyter Notebook environments. The document then covers Python basics like variables, data types, operators, decision making and loops. Finally, it discusses collection data types like lists, tuples and dictionaries and functions in Python.
This Edureka Python tutorial is a part of Python Course (Python Tutorial Blog: https://goo.gl/wd28Zr) and will help you in understanding what exactly is Python and its various applications. It also explains few Python code basics like data types, operators etc. Below are the topics covered in this tutorial:
1. Introduction to Python
2. Various Python Features
3. Python Applications
4. Python for Web Scraping
5. Python for Testing
6. Python for Web Development
7. Python for Data Analysis
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
This Edureka Python tutorial is a part of Python Course (Python Tutorial Blog: https://goo.gl/wd28Zr) and will help you in understanding what exactly is Python and its various applications. It also explains few Python code basics like data types, operators etc. Below are the topics covered in this tutorial:
1. Introduction to Python
2. Various Python Features
3. Python Applications
4. Python for Web Scraping
5. Python for Testing
6. Python for Web Development
7. Python for Data Analysis
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
Python programming | Fundamentals of Python programming KrishnaMildain
Basic Fundamentals of Python Programming.
What is Python, History of python, Advantages, Disadvantages, feature of python, scope, and many more.
Data Structure using Python, Object Oriented Programming using
YouTube Link:https://youtu.be/CVv8zhYEjUE
Edureka Python Certification Training: https://www.edureka.co/data-science-python-certification-course
This Edureka PPT on 'Python Programming' will help you learn Python programming basics with the help of interesting hands-on implementations.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
This Edureka Python tutorial will help you in learning various sequences in Python - Lists, Tuples, Strings, Sets, Dictionaries. It will also explain various operations possible on them. Below are the topics covered in this tutorial:
1. Python Sequences
2. Python Lists
3. Python Tuples
4. Python Sets
5. Python Dictionaries
6. Python Strings
Youtube Link: https://youtu.be/woVJ4N5nl_s
** Python Certification Training: https://www.edureka.co/data-science-python-certification-course **
This Edureka PPT on 'Python Basics' will help you understand what exactly makes Python special and covers all the basics of Python programming along with examples.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Projects will help you establish a foothold on Python by helping you assess and obtain skills which are used to design, develop and analyze projects built in Python.
1. Introduction to Python
2. Installation and Working with Python
3. Python Projects- 3levels
4. Practical approach - Code
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future:
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The amount of data available to us is growing rapidly, but what is required to make useful conclusions out of it?
Outline
1. Different tactics to gather your data
2. Cleansing, scrubbing, correcting your data
3. Running analysis for your data
4. Bring your data to live with visualizations
5. Publishing your data for rest of us as linked open data
Python programming | Fundamentals of Python programming KrishnaMildain
Basic Fundamentals of Python Programming.
What is Python, History of python, Advantages, Disadvantages, feature of python, scope, and many more.
Data Structure using Python, Object Oriented Programming using
YouTube Link:https://youtu.be/CVv8zhYEjUE
Edureka Python Certification Training: https://www.edureka.co/data-science-python-certification-course
This Edureka PPT on 'Python Programming' will help you learn Python programming basics with the help of interesting hands-on implementations.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
This Edureka Python tutorial will help you in learning various sequences in Python - Lists, Tuples, Strings, Sets, Dictionaries. It will also explain various operations possible on them. Below are the topics covered in this tutorial:
1. Python Sequences
2. Python Lists
3. Python Tuples
4. Python Sets
5. Python Dictionaries
6. Python Strings
Youtube Link: https://youtu.be/woVJ4N5nl_s
** Python Certification Training: https://www.edureka.co/data-science-python-certification-course **
This Edureka PPT on 'Python Basics' will help you understand what exactly makes Python special and covers all the basics of Python programming along with examples.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Projects will help you establish a foothold on Python by helping you assess and obtain skills which are used to design, develop and analyze projects built in Python.
1. Introduction to Python
2. Installation and Working with Python
3. Python Projects- 3levels
4. Practical approach - Code
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future:
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The amount of data available to us is growing rapidly, but what is required to make useful conclusions out of it?
Outline
1. Different tactics to gather your data
2. Cleansing, scrubbing, correcting your data
3. Running analysis for your data
4. Bring your data to live with visualizations
5. Publishing your data for rest of us as linked open data
This presentation is a great resource for zero-based Python programmers who wants to learn Python 3. This course includes brief history of Python and familiarity of its basic syntax.
Guido van Rossum emphasized the importance of code readability in Python. He introduced significant whitespace as a core feature of the language, aiming to enforce a clean and readable code structure. This emphasis on readability is evident in the presentation's mention of Python's design philosophy that highlights code readability.Van Rossum emphasized the importance of Python in enabling developers to write clear and logical code, which is scalable for both small and large-scale projects. The presentation mentions Python's language constructs and object-oriented approach designed to assist programmers in achieving this goal.
Though not explicitly attributed to van Rossum, Python's dynamically typed nature and built-in garbage collection contribute to its ease of use and simplification of memory management, reflecting the language's user-centric design principles.
Overall, Guido van Rossum's vision and design choices for Python resonate with the attributes and philosophies outlined in the presentation. His influence is seen in Python's core principles, which prioritize readability, versatility, and ease of use for programmers.
First in the series of slides for python programming, covering topics like programming language, python programming constructs, loops and control statements.
Python Course In Ghaziabad. Scode network is best training institute for Python which provides Online Python course with complete certificates at an affordable price.
This presentation provides the information on python including the topics Python features, applications, variables and operators in python, control statements, numbers, strings, print formatting, list and list comprehension, dictionaries, tuples, files, sets, boolean, mehtods and functions, lambda expressions and a sample project using Python.
ZENUS INFOTECH is best Python Training institute in Roorkee and an ISO 9001:2008 Certified Engineer’s Training Company in Roorkee & provides training to the B.E./B.TECH/DIPLOMA/MCA/BCA and related field students in 35+ cutting-edge technologies like AutoCAD, Solid-Works, CATIA, REVIT, Pro-E, UG-NX .NET, JAVA, PHP, GST Tally and Wireless & Telecommunication and many more.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
3. Get started
What is Python?
High-level,
General purpose,
Interpreted,
Interactive and object-oriented scripting language.
Python is designed to be highly readable
4. Features of Python
Easy to learn
Easy to read
Easy to maintain
A broad standard libraries
Interactive mode
5. Why Python?
"Why Python?“
The answer is simple: it is powerful yet very
accessible.
Also Python has become the most popular programming
language for data science because it allows us to forget
about the tedious parts of programming and offers us an
environment where we can quickly jot down our ideas and
put concepts directly into action.
6. Python installation
To install Python open a web browser go to
https://www.python.org/downloads.
Run the downloaded file.
Just accept the default settings and wait until
the install is finished.
7. Python IDLE
IDLE is a simple integrated development
environment (IDE) that comes with Python.
It’s a program that allows us to type in our
programs and run them.
You can find IDLE in the Python 3.7 folder on
your computer.
8. Cont...
When is started , the IDLE starts up in the
shell, which is an interactive window where we
can type in Python code and see the output in
the same window.
Most of the time we will want to open up a
new window and type the program in there.
9. Jupyter Notebook
We can use another Python platform called
Anaconda.
It includes different of popular data science
packages and virtual environment manager..
10. Cont..
Jupyter Notebook Is an open source web
application interactive and exploratory computing.
It allows us to create and share documents that
contain live code, equations, visualizations and
explanatory text.
We will work in Jupyter notebooks for all
practices
12. Python identifiers
Variable names can contain letters, numbers,
and the underscore.
Variable names cannot contain spaces
Variable names cannot start with a number.
Case matters—for instance, temp and Temp
are different.
13. Python keywords
and is not exec lambda for def if return def
import try elif in print raise while else with except
yield assert finally or break pass class from continue global
14. Lines and Indentation
Python provides no braces to indicate blocks of
code for class and function definitions or flow
control.
Blocks of code are denoted by line indentation.
The number of spaces in the indentation is
variable.
All statements within the block must be indented
the same amount.
15. Quotation in Python
Python accepts single ('), double (") and triple
(''' or """) quotes to denote string literals, as
long as the same type of quote starts and ends
the string.
The triple quotes are used to span the string
across multiple lines.
16. Comments in Python
A hash sign (#) that is not inside a string
literal begins a comment.
All characters after the # and up to the end of
the physical line are part of the comment and
the Python interpreter ignores them.
17. Printing
The print function requires parenthesis around its arguments.
To print several things at once, separate them by commas.
Python will automatically insert spaces between them.
Python will insert a space between each of the arguments of
the print function.
18. Cont…
There is an optional argument called sep, short
for separator, that we can use to change that space
to something else.
For example, using sep='##' would separate the
arguments by two pound signs.
The print function will automatically advance to
the next line.
19. Variable Types
Variables are nothing but reserved memory locations to
store values
Based on the data type of a variable, the interpreter
allocates memory and decides what can be stored in the
reserved memory.
Therefore, by assigning different data types to variables,
you can store integers, decimals, or characters in these
variables.
20. Standard data types in Python
Python has five standard data types:
Numbers
String
List
Tuple
Dictionary
21. Python numbers
Number data types store numeric values. Number
objects are created when you assign a value to them.
Python supports four different numerical types:-
int (signed integers)
long (long integers, they can also be represented in octal
and hexadecimal)
float (floating point real values)
complex (complex numbers)
22. Python strings
Strings in Python are identified as a contiguous set of
characters represented in the quotation marks.
Python allows for either pairs of single or double quotes.
Subsets of strings can be taken using the slice operator ([ ]
and [:] )
The plus (+) sign is the string concatenation operator and
the asterisk (*) is the repetition operator.
23. Python Tuples
A tuple is another sequence data type that is similar to the
list.
A tuple consists of a number of values separated by
commas.
The main differences between lists and tuples are:
Lists are enclosed in brackets ( [ ] ) and their elements and
size can be changed, while tuples are enclosed in parentheses
( ( ) ) and cannot be updated.
Tuples can be thought of as read-only lists.
24. Python Dictionary
Python's dictionaries consist of key-value pairs.
A dictionary key can be almost any Python type,
but are usually numbers or strings. Values, on the
other hand, can be any arbitrary Python object.
Dictionaries are enclosed by curly braces ({ }) and
values can be assigned and accessed using square
braces ([]).
25. Data Type Conversion
To convert between types, we simply use the
type name as a function.
There are several built-in functions to perform
conversion from one data type to another.
Example: int(), str().
27. Python Arithmetic Operators
Assume variable a holds 10 and b holds 20, then:
Operator Example
+ Addition a+b=30
- Subtraction a-b=10
* Multiplication a*b=200
/ Division a/b=2
% Modulus b%a=0
** Exponent a**b=10 to the power of 20
28. Python Comparison Operator
These operators compare the values on either
sides of them and decide the relation among
them. They are also called Relational operators.
Assume variable a holds 10 and variable b
holds 20, then:
29. Cont…
Operator Example
== (a==b) is not true
!= (a!=b) is true
<> (a<>b) is true. This is similar to !=
> (a>b) is not true
< (a<b) is true
>= (a>=b) is not true
<= (a<=b) is true
30. Python Assignment Operators
Assume variable a holds 10 and variable b holds 20,then:-
Operator Example
= c=a+b assigns value of a + b into c
+= Add AND c+= a is equivalent to c=c+a
-= Subtract AND c-= a is equivalent to c=c-a
*= Multiply c*= a is equivalent to c=c*a
/= Divide AND c/= a is equivalent to c=c/a
%= Modulus AND c%= a is equivalent to c=c%a
**= Exponent AND c**= a is equivalent to c=c**a
31. Python Logical Operators
There are following logical operators supported by Python
language. Assume variable a holds 10 and variable b holds 20 then:
Operator Example
and, logical AND (a and b) is true
or, logical OR (a or b) is true
not , logical NOT Not (a and b) is false
32. Python Membership Operators
Python’s membership operators test for membership in a
sequence, such as strings, lists, or tuples. There are two membership
operators as explained below:
Operator Example
in x in y , here , in results in a 1 if x is a member of
sequence y
not in x in not y , here , not results in a 1 if x is not a
member of sequence y
33. Python Identity Operators
Identity operators compare the memory locations of two
objects. There are two Identity operators as explained
below:
Operator Example
is x is y, here is results in 1 if id(x) equals id(y).
is not x is not y, here is not results in 1 if id(x) is not equal to id(y).
34. DECISION MAKING
Decision making is anticipation of conditions occurring while
execution of the program and specifying actions taken according to the
conditions.
Decision structures evaluate multiple expressions which
produce TRUE or FALSE as outcome.
Python programming language assumes any non-zero and non-
null values as TRUE, and if it is either zero or null, then it is assumed
as FALSE value.
35. Cont…
Python programming language provides following types
of decision making statements.
Statement Description
if statement if statement consists of a Boolean expression followed by one or more
statements.
if…else statement if statement can be followed by an optional else statement, which executes
when the Boolean expression is FALSE
Nested if
statement
You can use one if or else if statement inside another if or else if statement(s)
36. LOOPS
In general, statements are executed sequentially: The first
statement in a function is executed first, followed by the second,
and so on.
There may be a situation when you need to execute a block of
code several number of times.
A loop statement allows us to execute a statement or group of
statements multiple times.
37. Cont…
Python programming language provides following types of
loops to handle looping requirements.
Loop type Description
while loop Repeats a statement or group of statements while a given condition is TRUE. It
tests the condition before executing the loop body.
for loop Executes a sequence of statements multiple times and abbreviates the code
that manages the loop variable.
nested loop You can use one or more loop inside any another while , for or do…while loop
38. LOOP CONTROL STATEMENT
Loop control statements change execution
from its normal sequence. When execution
leaves a scope, all automatic objects that were
created in that scope are destroyed.
Python supports the following control
statements.
39. Cont…
Control
Statement
Description
continue Causes the loop to skip the remainder of its body and
immediately retest its condition prior to reiterating
break Terminates the loop statement and transfers execution
to the statement immediately following the loop.
pass The pass statement in Python is used when a statement
is required syntactically but you do not want any
command or code to execute.
40. COLLECTION DATA TYPES
Lists
The list is a most versatile datatype available in
Python which can be written as a list of comma-
separated values (items) between square brackets.
Important thing about a list is that items in a list
need not be of the same type.
Creating a list is as simple as putting different
comma-separated values between square brackets.
42. Basic List Operation
Lists respond to the + and * operators much like strings;
they mean concatenation and repetition here too, except
that the result is a new list, not a string.
Python Expression Results Description
Len([1,2,3]) 3 Length
[1,2,3]+[4,5,6] [1,2,3,4,5,6] Concatenation
[“A”]*4 [‘A’,’A’,’A’,’A’] Repetition
3 in [1,2,3] True Membership
43. Indexing and Slicing
Because lists are sequences, indexing and slicing work the
same way for lists as they do for strings.
Assume the following input:
L=[‘CIVE’, ’Cive’, ‘CIVE’]
Python Results Description
L[2] ‘CIVE’ Offsets start at zero
L[-2] ‘Cive’ Negative count from the
right
L[1:] [‘Cive’ , ‘CIVE’] Slicing fetches sectors
44. Built-in List Functions and Methods
Python includes the following list functions:
Function Description
cmp(list1,list2) Compares elements of both lists.
len(list) Gives the total length of the list
max(list) Returns item from the list with max
value.
min(list) Returns item from the list with min
value.
list(seq) Converts a tuple into list
45. Cont…
Python includes the following list methods:
Methods Description
list.append(obj) Appends object obj to list
list.count(obj) Returns count of how many times obj occurs in list
list.extend(seq) Appends the contents of seq to list
list.index(obj) Returns the lowest index in list that obj appears
list.insert(index,obj) Inserts object obj into list at offset index
list.pop(obj=list[-1]) Removes and returns last object or obj from list
list.remove(obj) Removes object obj from list
List.reverse() Reverses objects of list in place
46. Tuples
A tuple is a sequence of immutable Python objects.
Tuples are sequences, just like lists.
The differences between tuples and lists are, the
tuples cannot be changed unlike lists and tuples
use parentheses, whereas lists use square brackets.
47. Accessing Values In Tiples
To access values in tuple, use the square brackets for
slicing along with the index or indices to obtain value
available at that index.
Example:
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5, 6, 7 );
print("tup1[0]: ",tup1[0])
print("tup2[1:5]: ", tup2[1:5])
48. Dictionary
Dictionary this is a collection data type which have pairs
of keys and values.
Each key is separated from its value by a colon (:), the
items are separated by commas, and the whole thing is
enclosed in curly braces.
Keys are unique within a dictionary while values may not
be. The values of a dictionary can be of any type, but the
keys must be of an immutable data type such as strings,
numbers, or tuples.
49. Accessing Values In Dictionary
An empty dictionary without any items is written with
just two curly braces, like this: {}.
To access dictionary elements, you can use the familiar
square brackets along with the key to obtain its value.
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print("dict['Name']: ", dict['Name'])
print("dict['Age']: ", dict['Age'])
50. Built-in Dictionary Function and Methods
Python includes the following dictionary functions:-
Function Description
cmp(dict1,dict2) Compares elements of both dict
len(dict) Gives the total length of the dictionary. This would be equal to
the number of items in the dictionary
str() Produces a printable string representation of a dictionary
type(variable) Returns the type of the passed variable. If passed variable is
dictionary, then it would return a dictionary type
51. Cont…
Python includes the following dictionary methods:
Method Description
dict.clear() Removes all elements of dictionary dict
dict.copy() Returns a shallow copy of dictionary dict
dict.fromkeys() Create a new dictionary with keys from seq and values set to value.
dict.get(key,default=None) For key key, returns value or default if key not in dictionary
dict.has_key(key) Returns true if key in dictionary dict, false otherwise
dict.values() Returns list of dictionary dict’s values
dict.items() Returns a list of dict's (key, value) tuple pairs
dict.keys() Returns list of dictionary dict's keys
52. FUNCTIONS
A function is a block of organized, reusable
code that is used to perform a single, related
action.
As you already know, Python gives us many
built-in functions such as print(), but we can
also create our own functions. These functions
are called user-defined functions
53. Defining a function
Begin with the keyword def followed by the function name and
parentheses ( ( ) ).
Any input parameters should be placed within these parentheses.
We can also define parameters inside these parentheses.
The code block within every function starts with a colon (:) and is
indented.
The statement return [expression] exits a function, optionally
passing back an expression to the caller. A return statement with no
arguments is the same as return None.
54. Calling a function
Defining a function only gives it a name, specifies
the parameters that are to be included in the
function and structures the blocks of code.
Once the basic structure of a function is finalized,
you can execute it by calling it from another
function or directly from the Python prompt.
55. Function Arguments
A Python function can be called by using the
following types of formal arguments:
Required arguments
Keyword arguments
Default arguments
Variable-length arguments
56. The return statement
The statement return [expression] exits a
function, optionally passing back an expression
to the caller.
A return statement with no arguments is the
same as return None.
57. Scope of Variables
There are two basic scopes of variables in Python:
Global variables
Local variables
58. Global Vs. Local Variables
Local variables
These are variables that are defined inside a
function body.
Global variables.
These are variables which are declared outside a
function.
59. OBJECT ORIENTED PROGRAMMING
Object oriented programming is a very popular
paradigm of programming, where objects are created
using classes, which are actually the focal point of
OOP .
The class describes what the object will be, but is
separate from the object itself.
61. Destroying Objects(Garbage Collection)
Python deletes unneeded objects (built-in types or
class instances) automatically to free the memory
space.
The process by which Python periodically reclaims
blocks of memory that no longer are in use is termed
Garbage Collection.
.
62. Methods Overriding
You can always override your parent class
methods. One reason for overriding parent's
methods is because you may want special or
different functionality in your subclass.