Python

Data structures

How it works under the hood

  • List

These are examples of sequence and they have membership test e.g. in or not in. Apple in fruits.

For list and tuple these are O(n)

For set and dict it’s O(1) since they use hashing

There are three control flow statements in Python — if, for and while.

The continue statement is used to tell Python to skip the rest of the statements in the current loop block and to continue to the next iteration of the loop.

The break statement is used to break out of a loop statement i.e. stop the execution of a looping statement, even if the loop condition has not become False or the sequence of items has not been completely iterated over.

An important note is that if you break out of a for or while loop, any corresponding loop else block is not executed.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Self Destruct Code for Linux Computers

My Daily Driver Chrome Extensions — Issue #3

DevOps 101: Container Registries

NEM and IoDLT — Using Tardigrade to Accelerate MongoDB Snapshot Distribution and Storage

The very fundamentals of Docker images management (2/2)

ARK Core upgrade to V2.4 — Introducing P2P WebSockets

SafuFinance @Airdrop

Shift: Phoenix 0.6.0

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Natarajan Santhosh

Natarajan Santhosh

More from Medium

What is Variable in Python?

Python While — Loop

Data Structures in Python

Python