This presentation is all about various built in
datastructures which we have in python.
List
Dictionary
Tuple
Set
and various methods present in each data structure
Python is a widely used high-level programming language for general-purpose programming. Python is a simple, powerful and easy to learn the programming language. It is commonly used for Web and Internet development, Scientific and Numeric computing, Business application and Desktop GUI development etc. The basic data structures in python are lists, dictionaries, tuples, strings and sets
This presentation is all about various built in
datastructures which we have in python.
List
Dictionary
Tuple
Set
and various methods present in each data structure
Python is a widely used high-level programming language for general-purpose programming. Python is a simple, powerful and easy to learn the programming language. It is commonly used for Web and Internet development, Scientific and Numeric computing, Business application and Desktop GUI development etc. The basic data structures in python are lists, dictionaries, tuples, strings and sets
YouTube Link: https://youtu.be/giJimUEkI7U
**Java, J2EE & SOA Certification Training - https://www.edureka.co/java-j2ee-training-course **
This Edureka PPT will provide you with detailed knowledge about Linked Lists in Java and along with it, This PPT will also cover some examples of Linked Lists in Java, in order to provide you with a deep understanding of their functionality. This PPT will cover the following topics:
What is a Linked List?
Types of Linked Lists
Features of Linked Lists
Methods in Linked Lists
Array v/s Linked List
Complete Java Playlist: http://bit.ly/2XcYNH5
Complete Blog Series: http://bit.ly/2YoabkT
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
a. Concept and Definition✓
b. Inserting and Deleting nodes ✓
c. Linked implementation of a stack (PUSH/POP) ✓
d. Linked implementation of a queue (Insert/Remove) ✓
e. Circular List
• Stack as a circular list (PUSH/POP) ✓
• Queue as a circular list (Insert/Remove) ✓
f. Doubly Linked List (Insert/Remove) ✓
For more course related material:
https://github.com/ashim888/dataStructureAndAlgorithm/
Personal blog
www.ashimlamichhane.com.np
Object oriented programming with pythonArslan Arshad
A short intro to how Object Oriented Paradigm work in Python Programming language. This presentation created for beginner like bachelor student of Computer Science.
What are Data structures in Python? | List, Dictionary, Tuple Explained | Edu...Edureka!
YouTube Link: https://youtu.be/m9n2f9lhtrw
** Python Certification Training: https://www.edureka.co/data-science-python-certification-course **
This Edureka video on 'Data Structures in Python' will help you understand the various data structures that Python has built into itself such as the list, dictionary, tuple and more. Further, we will also understand stacks, queues, trees and how they are implemented in Python using classes and functions. The video is divided into the following parts:
What are Data Structures?
Why are Data Structures needed?
Types of Data Structures in Python
Built-In Data Structures
Lists
Dictionary
Tuple
Sets
User-Defined Data Structure
Array
Stack
Queue
Linked List
Tree
Graph
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 presentation is made for the students who finds data structures a complex subject
this will help students to grab the various topics of data structures with simple presentation techniques
best regards
BCA group
(pooja,shaifali,richa,trishla,rani,pallavi,shivani)
File Handling is used in C language for store a data permanently in computer.
Using file handling you can store your data in Hard disk.
http://www.tutorial4us.com/cprogramming/c-file-handling
Arrays In Python | Python Array Operations | EdurekaEdureka!
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Arrays in Python' will help you establish a strong hold on all the fundamentals in the Python programming language. Below are the topics covered in this PPT:
What is an array?
Is python list same as an array?
How to create arrays in python?
Accessing array elements
Basic array operations
- Finding the length of an array
- Adding Elements
- Removing elements
- Array concatenation
- Slicing
- Looping
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
YouTube Link: https://youtu.be/giJimUEkI7U
**Java, J2EE & SOA Certification Training - https://www.edureka.co/java-j2ee-training-course **
This Edureka PPT will provide you with detailed knowledge about Linked Lists in Java and along with it, This PPT will also cover some examples of Linked Lists in Java, in order to provide you with a deep understanding of their functionality. This PPT will cover the following topics:
What is a Linked List?
Types of Linked Lists
Features of Linked Lists
Methods in Linked Lists
Array v/s Linked List
Complete Java Playlist: http://bit.ly/2XcYNH5
Complete Blog Series: http://bit.ly/2YoabkT
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
a. Concept and Definition✓
b. Inserting and Deleting nodes ✓
c. Linked implementation of a stack (PUSH/POP) ✓
d. Linked implementation of a queue (Insert/Remove) ✓
e. Circular List
• Stack as a circular list (PUSH/POP) ✓
• Queue as a circular list (Insert/Remove) ✓
f. Doubly Linked List (Insert/Remove) ✓
For more course related material:
https://github.com/ashim888/dataStructureAndAlgorithm/
Personal blog
www.ashimlamichhane.com.np
Object oriented programming with pythonArslan Arshad
A short intro to how Object Oriented Paradigm work in Python Programming language. This presentation created for beginner like bachelor student of Computer Science.
What are Data structures in Python? | List, Dictionary, Tuple Explained | Edu...Edureka!
YouTube Link: https://youtu.be/m9n2f9lhtrw
** Python Certification Training: https://www.edureka.co/data-science-python-certification-course **
This Edureka video on 'Data Structures in Python' will help you understand the various data structures that Python has built into itself such as the list, dictionary, tuple and more. Further, we will also understand stacks, queues, trees and how they are implemented in Python using classes and functions. The video is divided into the following parts:
What are Data Structures?
Why are Data Structures needed?
Types of Data Structures in Python
Built-In Data Structures
Lists
Dictionary
Tuple
Sets
User-Defined Data Structure
Array
Stack
Queue
Linked List
Tree
Graph
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 presentation is made for the students who finds data structures a complex subject
this will help students to grab the various topics of data structures with simple presentation techniques
best regards
BCA group
(pooja,shaifali,richa,trishla,rani,pallavi,shivani)
File Handling is used in C language for store a data permanently in computer.
Using file handling you can store your data in Hard disk.
http://www.tutorial4us.com/cprogramming/c-file-handling
Arrays In Python | Python Array Operations | EdurekaEdureka!
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Arrays in Python' will help you establish a strong hold on all the fundamentals in the Python programming language. Below are the topics covered in this PPT:
What is an array?
Is python list same as an array?
How to create arrays in python?
Accessing array elements
Basic array operations
- Finding the length of an array
- Adding Elements
- Removing elements
- Array concatenation
- Slicing
- Looping
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Building Data Ecosystems for Accelerated Discoveryadamkraut
Large federated data ecosystems require diverse teams that can design, build, and integrate a broad range of services to support scientific workflows. Our collaborative team operates at the intersection of science, technology, and data to assess, implement, and teach the key capabilities and capacities modern healthcare and life science needs. Learn the data management techniques, tools, platforms, and frameworks that are proven to be effective at solving complex problems at scale.
Presentation of the initial draft of the shared harmonized data model for the Cancer Research Data Center nodes. The CRDC-H leverages existing standards, where possible and are designed to meet the needs of systems like the Cancer Data Aggregator (CDA) that support integrated search and metadata-based analyses across datasets in the CRDC ecosystem.
Worldranking universities final documentationBhadra Gowdra
With the upcoming data deluge of semantic data, the fast growth of ontology bases has brought significant challenges in performing efficient and scalable reasoning. Traditional centralized reasoning methods are not sufficient to process large ontologies. Distributed searching methods are thus required to improve the scalability and performance of inferences. This paper proposes an incremental and distributed inference method for large-scale ontologies by using Map reduce, which realizes high-performance reasoning and runtime searching, especially for incremental knowledge base. By constructing transfer inference forest and effective assertion triples, the storage is largely reduced and the search process is simplified and accelerated. We propose an incremental and distributed inference method (IDIM) for large-scale RDF datasets via Map reduce. The choice of Map reduce is motivated by the fact that it can limit data exchange and alleviate load balancing problems by dynamically scheduling jobs on computing nodes. In order to store the incremental RDF triples more efficiently, we present two novel concepts, i.e., transfer inference forest (TIF) and effective assertion triples (EAT). Their use can largely reduce the storage and simplify the reasoning process. Based on TIF/EAT, we need not compute and store RDF closure, and the reasoning time so significantly decreases that a user’s online query can be answered timely, which is more efficient than existing methods to our best knowledge. More importantly, the update of TIF/EAT needs only minimum computation since the relationship between new triples and existing ones is fully used, which is not found in the existing literature. In order to store the incremental RDF triples more efficiently, we present two novel concepts, transfer inference forest and effective assertion triples. Their use can largely reduce the storage and simplify the searching process.
Makine Öğrenmesi, Yapay Zeka ve Veri Bilimi Süreçlerinin Otomatikleştirilmesi...Ali Alkan
Makine Öğrenmesi, Yapay Zeka ve Veri Bilimi Süreçlerinin Otomatikleştirilmesi | Automating Machine Learning, Artificial Intelligence, and Data Science | Guided Analytics
Crossing the Analytics Chasm and Getting the Models You Developed DeployedRobert Grossman
There are two cultures in data science and analytics - those that develop analytic models and those that deploy analytic models into operational systems. In this talk, we review the life cycle of analytic models and provide an overview of some of the approaches that have been developed for managing analytic models and workflows and for deploying them, including using analytic engines and analytic containers . We give a quick overview of languages for analytic models (PMML) and analytic workflows (PFA). We also describe the emerging discipline of AnalyticOps that has borrowed some of the techniques of DevOps.
Canadian Experts Discuss Modern Data Stacks and Cloud Computing for 5 Years o...Daniel Zivkovic
Two #ModernDataStack talks and one DevOps talk: https://youtu.be/4R--iLnjCmU
1. "From Data-driven Business to Business-driven Data: Hands-on #DataModelling exercise" by Jacob Frackson of Montreal Analytics
2. "Trends in the #DataEngineering Consulting Landscape" by Nadji Bessa of Infostrux Solutions
3. "Building Secure #Serverless Delivery Pipelines on #GCP" by Ugo Udokporo of Google Cloud Canada
We ran out of time for the 4th presenter, so the event will CONTINUE in March... stay tuned! Compliments of #ServerlessTO.
All data accessible to all my organization - Presentation at OW2con'19, June...OW2
It is clear that all employees must have access to data wherever they are to make decisions. However, tools that allow to share data just as easily as the best collaborative tools such as a google doc or an office 365 should be used.
Open source driven by the big data ecosystem and a number of large companies have provided solutions to allow organizations to federate data systems and secure their access.
After a quick overview of existing open source solutions, and how such projects can be organized, it will be necessary to detail Dremio implementation, a unique and centralized interface on all your data. Some real feedbacks will conclude the presentation.
Machine Learning in the Cloud has influences operations company-wide. Learn from Data Scientist, Ahmed Sherif, how to leverage Cloud offerings including AWS, IBM Cloud, and Microsoft Azure.
Simplified Machine Learning, Text, and Graph Analytics with Pivotal GreenplumVMware Tanzu
Data is at the center of digital transformation; using data to drive action is how transformation happens. But data is messy, and it’s everywhere. It’s in the cloud and on-premises. It’s in different types and formats. By the time all this data is moved, consolidated, and cleansed, it can take weeks to build a predictive model.
Even with data lakes, efficiently integrating multi-structured data from different data sources and streams is a major challenge. Enterprises struggle with a stew of data integration tools, application integration middleware, and various data quality and master data management software. How can we simplify this complexity to accelerate and de-risk analytic projects?
The data warehouse—once seen as only for traditional business intelligence applications — has learned new tricks. Join James Curtis from 451 Research and Pivotal’s Bob Glithero for an interactive discussion about the modern analytic data warehouse. In this webinar, we’ll share insights such as:
- Why after much experimentation with other architectures such as data lakes, the data warehouse has reemerged as the platform for integrated operational analytics
- How consolidating structured and unstructured data in one environment—including text, graph, and geospatial data—makes in-database, highly parallel, analytics practical
- How bringing open-source machine learning, graph, and statistical methods to data accelerates analytical projects
- How open-source contributions from a vibrant community of Postgres developers reduces adoption risk and accelerates innovation
We thank you in advance for joining us.
Presenter : Bob Glithero, PMM, Pivotal and James Curtis Senior Analyst, 451 Research
Similar to Lecture 9 - DSA - Python Data Structures (20)
Overview of the different data models, mainly: flat file, hierarchical, network, relational, and object-oreitned. CAP theorem, NoSQL major four models: Document-oriented, Column-oriented, Key-Value store, and Graph. Followed by an overview of some of the famous no-sql products: Redis, Cassandra, MongoDB, and Neo4j.
My Presentation about EMC Academic Alliance Program at Mansoura University. In this presentation, I tried to present an introduction on the most four famous EMC courses, and an overlook on the most EMC famous products.
Boot to Gecko is the Latest Mozilla Contribution to the Larger Open Web Project. Why we needed B2G? What are the Pros and Cons? What are the Challenges and Opportunities? Interesting Session by Haitham El-Ghareeb
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Thesis Statement for students diagnonsed withADHD.ppt
Lecture 9 - DSA - Python Data Structures
1. Data Structures in Python
Crash Course
Dr.Haitham A. El-Ghareeb
Information Systems Department
Faculty of Computers and Information Sciences
Mansoura University
helghareeb@gmail.com
December 9, 2012
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 1 / 61
2. Agenda
• Whe*ng
Your
Appe0te
• Using
Python
Interpreter
• Informal
Introduc0on
to
Python
• More
Control
Flows
• Data
Structures
• Modules
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 2 / 61
3. Python
• Easy
to
learn,
powerful
programming
language.
• Has
efficient
high-‐level
data
structures
and
a
simple
but
effec0ve
approach
to
object-‐
oriented
programming.
– elegant
syntax
– dynamic
typing
– interpreted
nature
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 3 / 61
4. Python
• Simpler
to
use
• Available
on
Windows,
Mac
OS
X,
and
Unix
• Help
you
get
the
job
done
more
quickly
• Split
your
program
into
modules
that
can
be
reused
• Python
is
an
interpreted
language:
– Save
you
considerable
0me
during
program
development
because
no
compila0on
and
linking
is
necessary.
– Interpreter
can
be
used
interac0vely
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 4 / 61
5. Python
• Python
is
extensible:
if
you
know
how
to
program
in
C
it
is
easy
to
add
a
new
built-‐in
func0on
or
module
to
the
interpreter,
• Named
aSer
the
BBC
show
“Monty
Python’s
Flying
Circus”
and
has
nothing
to
do
with
rep0les.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 5 / 61
6. Using
the
Python
Interpreter
• Python
interpreter
is
usually
installed
as
/usr/
local/bin/python
• Invoking
the
Interpreter
– A
second
way
of
star0ng
the
interpreter
is
python
-‐c
command
[arg]
...,
which
executes
the
statement(s)
in
command
– Some
Python
modules
are
also
useful
as
scripts.
These
can
be
invoked
using
python
-‐m
module
[arg]
...,
which
executes
the
source
file
for
module
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 6 / 61
7. Using
Python
Interpreter
• Argument
Passing
• Interac0ve
Mode
• Error
Handling
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 7 / 61
8. Executable
Python
Scripts
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 8 / 61
9. Source
Code
Encoding
• It
is
possible
to
use
encodings
different
than
ASCII
in
Python
source
files.
• The
best
way
to
do
it
is
to
put
one
more
special
comment
line
right
aSer
the
#!
line
to
define
the
source
file
encoding:
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 9 / 61
16. String
Indexing
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 16 / 61
17. String
Slicing
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 17 / 61
18. Strings
are
Immutable!
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 18 / 61
19. Indices
May
be
Nega0ve
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 19 / 61
20. How
Come?!
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 20 / 61
21. Lists
• compound
data
type
• used
to
group
together
other
values
• The
most
versa0le
• can
be
wricen
as
a
list
of
comma-‐separated
values
(items)
between
square
brackets.
• List
items
need
not
all
have
the
same
type.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 21 / 61
22. Shallow
Copy
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 22 / 61
23. First
Steps
toward
Programming
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 23 / 61
24. More
Control
Flow
Tools
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 24 / 61
25. If
Statement
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 25 / 61
26. For
Statement
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 26 / 61
27. For
Statement
with
Shallow
Copy
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 27 / 61
28. Range
Func0on
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 28 / 61
29. Break,
Con0nue,
Else
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 29 / 61
30. Pass
• Does
Nothing!
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 30 / 61
31. Func0ons
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 31 / 61
32. Return
Statement
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 32 / 61
33. Default
Argument
Value
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 33 / 61
35. Coding
Style
-‐
PEP8
• Use
4-‐space
indenta0on,
and
no
tabs.
• 4
spaces
are
a
good
compromise
between
small
indenta0on
(allows
greater
nes0ng
depth)
and
large
indenta0on
(easier
to
read).
Tabs
introduce
confusion,
and
are
best
leS
out.
• Wrap
lines
so
that
they
don’t
exceed
79
characters.
• This
helps
users
with
small
displays
and
makes
it
possible
to
have
several
code
files
side-‐by-‐side
on
larger
displays.
• Use
blank
lines
to
separate
func0ons
and
classes,
and
larger
blocks
of
code
inside
func0ons.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 35 / 61
36. Coding
Style
-‐
PEP8
• When
possible,
put
comments
on
a
line
of
their
own.
• Use
docstrings.
• Use
spaces
around
operators
and
aSer
commas,
but
not
directly
inside
bracke0ng
constructs:
a
=
f(1,
2)
+
g(3,
4).
• Name
your
classes
and
func0ons
consistently;
the
conven0on
is
to
use
CamelCase
for
classes
and
lower_case_with_underscores
for
func0ons
and
methods.
Always
use
self
as
the
name
for
the
first
method
argument.
• Don’t
use
fancy
encodings
if
your
code
is
meant
to
be
used
in
interna0onal
environments.
Plain
ASCII
works
best
in
any
case.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 36 / 61
37. Data
Structures
-‐
Lists
• list.append(x)
Add
an
item
to
the
end
of
the
list.
• list.extend(L)
Extend
the
list
by
appending
all
the
items
in
the
given
list.
• list.insert(i,
x)
Insert
an
item
at
a
given
posi0on.
The
first
argument
is
the
index
of
the
element
before
which
to
insert,
so
a.insert(0,
x)
inserts
at
the
front
of
the
list,
and
a.insert(len(a),
x)
is
equivalent
to
a.append(x).
• list.remove(x)
Remove
the
first
item
from
the
list
whose
value
is
x.
It
is
an
error
if
there
is
no
such
item.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 37 / 61
38. Data
Structures
-‐
Lists
• list.pop([i])
Remove
the
item
at
the
given
posi0on
in
the
list,
and
return
it.
If
no
index
is
specified,
a.pop()
removes
and
returns
the
last
item
in
the
list.
• list.index(x)
Return
the
index
in
the
list
of
the
first
item
whose
value
is
x.
It
is
an
error
if
there
is
no
such
item.
• list.count(x)
Return
the
number
of
0mes
x
appears
in
the
list.
• list.sort()
Sort
the
items
of
the
list,
in
place.
• list.reverse()
Reverse
the
elements
of
the
list,
in
place.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 38 / 61
39. Lists
Example
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 39 / 61
40. Using
Lists
as
Stack
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 40 / 61
41. Using
List
as
a
Queue
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 41 / 61
42. Func0onal
Programming
Tools
• There
are
three
built-‐in
func0ons
that
are
very
useful
when
used
with
lists:
filter(),
map(),
and
reduce().
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 42 / 61
43. Filter()
• filter(func0on,
sequence)
returns
a
sequence
consis0ng
of
those
items
from
the
sequence
for
which
func0on(item)
is
true.
• If
sequence
is
a
string
or
tuple,
the
result
will
be
of
the
same
type;
otherwise,
it
is
always
a
list.
• For
example,
to
compute
a
sequence
of
numbers
not
divisible
by
2
and
3:
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 43 / 61
44. Filter()
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 44 / 61
45. Map()
• map(func0on,
sequence)
calls
func0on(item)
for
each
of
the
sequence’s
items
and
returns
a
list
of
the
return
values.
• For
example,
to
compute
some
cubes:
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 45 / 61
46. Map()
• More
than
one
sequence
may
be
passed;
the
func0on
must
then
have
as
many
arguments
as
there
are
sequences
and
is
called
with
the
corresponding
item
from
each
sequence
(or
None
if
some
sequence
is
shorter
than
another).
For
example:
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 46 / 61
47. Reduce()
• reduce(func0on,
sequence)
returns
a
single
value
constructed
by
calling
the
binary
func0on
func2on
on
the
first
two
items
of
the
sequence,
then
on
the
result
and
the
next
item,
and
so
on.
• For
example,
to
compute
the
sum
of
the
numbers
1
through
10:
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 47 / 61
48. Tuples
and
Sequences
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 48 / 61
49. Comma
at
the
end!
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 49 / 61
50. Sets
• A
set
is
an
unordered
collec0on
with
no
duplicate
elements.
• Basic
uses
include
membership
tes0ng
and
elimina0ng
duplicate
entries.
• Set
objects
also
support
mathema0cal
opera0ons
like
union,
intersec0on,
difference,
and
symmetric
difference.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 50 / 61
52. Dic0onaries
• Dic0onaries
are
some0mes
found
in
other
languages
as
“associa0ve
memories”
or
“associa0ve
arrays”.
• Unlike
sequences,
which
are
indexed
by
a
range
of
numbers,
dic0onaries
are
indexed
by
keys,
which
can
be
any
immutable
type;
strings
and
numbers
can
always
be
keys.
• Tuples
can
be
used
as
keys
if
they
contain
only
strings,
numbers,
or
tuples;
if
a
tuple
contains
any
mutable
object
either
directly
or
indirectly,
it
cannot
be
used
as
a
key.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 52 / 61
53. Dic0onaries
• You
can’t
use
lists
as
keys,
since
lists
can
be
modified
in
place
using
index
assignments,
slice
assignments,
or
methods
like
append()
and
extend().
• It
is
best
to
think
of
a
dic0onary
as
an
unordered
set
of
key:
value
pairs,
with
the
requirement
that
the
keys
are
unique
(within
one
dic0onary).
• A
pair
of
braces
creates
an
empty
dic0onary:
{}.
Placing
a
comma-‐separated
list
of
key:value
pairs
within
the
braces
adds
ini0al
key:value
pairs
to
the
dic0onary;
this
is
also
the
way
dic0onaries
are
wricen
on
output.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 53 / 61
54. Dic0onaries
• The
main
opera0ons
on
a
dic0onary
are
storing
a
value
with
some
key
and
extrac0ng
the
value
given
the
key.
• It
is
also
possible
to
delete
a
key:value
pair
with
del.
If
you
store
using
a
key
that
is
already
in
use,
the
old
value
associated
with
that
key
is
forgocen.
It
is
an
error
to
extract
a
value
using
a
non-‐existent
key.
• The
keys()
method
of
a
dic0onary
object
returns
a
list
of
all
the
keys
used
in
the
dic0onary,
in
arbitrary
order
(if
you
want
it
sorted,
just
apply
the
sorted()
func0on
to
it).
• To
check
whether
a
single
key
is
in
the
dic0onary,
use
the
in
keyword.
Dr.Haitham A. El-Ghareeb (CIS) Data Structures and Algorithms - 2012 December 9, 2012 54 / 61