Learn Fundamentals of
Computer Programming
Using Python - Part 2

Sponsored by - Dreamcatcher IT

Venue - Premier University Chittagong

About me

CEO, Founder of Dreamcatcher IT

 

Pythonista, Javascript Enthusiast, Thinker, Day Dreamer, And an introvert with exception!

 

  • Former Software Engineer, Team Lead, RDS Solutions
  • ICT Certified@2014 Android  Application Development Trainer

Basic Data Structures

Scenerio

store name, id, batch & department of students

Naive Approach using variables

name1 = "John Doe"
id1 = "1121120598"
batch1 = "21st"
department1 = "CSE"

name2 = "Bon Joe"
id2 = "1121120524"
batch2 = "22nd"
department2 = "CSE"
# ... ... ...
name43 = "Brave X"
id43 = "1121120123"
batch43 = "51st"
department43 = "CSE"

Using Loop


for i in range(43):
    name = input()
    std_id = input()
    batch = input()
    department = input()
    # do all the stuff related to this student
    # process each student in one go

Using Lists


std_names, std_ids, batches, depts = [], [], [], []
for i in range(43):
    name = input()
    std_id = input()
    batch = input()
    department = input()
    std_names.append(name)
    std_ids.append(std_id)
    batfches.append(batch)
    depts.append(department)

# access first student
std_names[0], std_ids[0], batches[0], depts[0]

# adding new student in middle of the list or removing student is hazardous!

Using Dictionary

students = dict()
for i in range(43):
    name = input()
    std_id = input()
    batch = input()
    department = input()
    students[std_id] = [
         name,
         batch,
         department,
    ]
# access student name
students['1'][0]
# access student department
students['1'][2]

Using Dictionary of Dictionary

students = dict()
for i in range(43):
    name = input()
    std_id = input()
    batch = input()
    department = input()
    students[std_id] = {
         "name": name,
         "batch": batch,
         "department": department
    }
# access student name
students['1']['name']
# access student department
students['1']['department']

STACK Implementation in Python

Queue Implementation
in
Python

Basic
Algorithm Implementations

Factorial

Factorial Iterative

Factorial Recursive

Project Specification
&
Implementation

Code Refactor

&

Improvement

Best Practices

Until we meet again!

Thank you!

All the images and logos in this slide are collected from Internet and, used only for educational purpose. 

Be Pythonic!

Learn Fundamentals of Computer Programming Using Python Part 2

By Wasi Mohammed Abdullah

Learn Fundamentals of Computer Programming Using Python Part 2

  • 71
Loading comments...

More from Wasi Mohammed Abdullah