Python 2
Python 2
Session 2
What will you learn ?
• Introduction • Literals
• Introduction to Data Sets • Conditionals
• Concepts of Variables, Iterations & • Loops
Filtering • Functions
• Data Types • Lists & Tupules
• Sanity of Data • Sets & Dictionaries
• Introduction to Complex Data Types • File Handling
• Hands – On Python • Object Oriented Programming
Introduction to Data Sets
1. Data Sets –
1. Student Performance
2. Deck of Cards
2. Assignment 1-
1. Count the no of Cards in a Deck
2. Count the no of Red cards in a deck
3. Count the no of students in the data set
4. Count the no of students from North India
Assignment -1
2. Iterate :- Going through the sequence of objects as you go on from one object to
another keep a count- It will always have a condition – till when to iterate …
4. Increment :- Every time you move an object = you increment the count by 1
2. Iterate :- Going through the sequence of objects as you go on from one object to
another keep a count
5. Increment :- Every time you move an object = you increment the Count by 1
6. Increment :- Every time you find a red card while moving an object = you
increment the Red Count by 1
The first approach to structured thinking is to put steps to the business problems
• Flow Chart
• Pictorial representation of computational process
• Let us take an simple illustration:- Counting the number of cards
Flow Charts
• Node types
1. Process or Activity - Rectangular box Activities which
the value of a variable
2. Arrows indicate operation flow- Flow Line or the
order or the direction
3. Decision- Diamond Box- You take a decision in which
direction the program would take
4. Terminal- Oval shaped – Beginning or end of the
program
• Advantage
1. Visual representation of computation
2. Easy to understand
• Disadvantages
1. Size: Complex processes generate large flowcharts
2. Collaboration: Sharing pictures in editable format
3. Versions: Compare changes between flow charts
From Visuals to Steps & Words
Initialize
Update Variables
No - False
Unvisited
End
elements ?
Yes – True
Start
Count = 0
while (Pile 1 has more cards) {
Pick a card X from Pile 1
Move X to Pile 2
Increment Count
}
End
Pseudocode
Start
Count = 0
while (Pile 1 has more cards) {
Pick a card X from Pile 1
Move X to Pile 2
Increment Count
}
End
Pseudocode
Start
Count = 0
while (Pile 1 has more cards) {
Pick a card X from Pile 1
Move X to Pile 2
Increment Count
}
End
1- Assign a Value to a Variable
Pseudocode
Start
Count = 0
while (Pile 1 has more cards) {
Pick a card X from Pile 1
Move X to Pile 2
Increment Count
}
End
1- Assign a Value to a Variable
2- Repeat steps while conditions holds
Pseudocode
Start
Count = 0
while (Pile 1 has more cards) {
Pick a card X from Pile 1
Move X to Pile 2
Increment Count
}
End
1- Assign a Value to a Variable
2- Repeat steps while conditions holds
3- Mark Start & End of A Repeated Block
Summary
• https://drive.google.com/drive/my-drive
• https://www.python.org/
• https://www.python.org/psf/
• http://www.replit.com/
• https://docs.replit.com/tutorials/introduction-to-the-repl-it-ide
8
Things to initiated – Assignment
Set up & create the following accounts using SIES Id .