Open In Colab

Python Basics | Some Fundamentals in 10 minutes

1 | Introduction

1.1 | A simple start

1.2 | Python syntax is very readable and easily understood.

1.3 | The Python Intepreter

2 | Some Python Basics

2.1 | Comments in Python

2.2 | Python is case sensitive

2.3 | x is a variable. 'x' is an English letter.

2.4 | = is not the same as '=='

2.5 | Be careful of spaces(indentations) at the start of a line

2.6 | Python has many (many) cool packages

Basic Python is limited but can be extended with packages.

Let's understand what this means.

Let's import a package called math to fix this problem.

We can use other packages too. Lets consider the package numpy.

2.7 | The . and 'hidden' functions

The . shows ownership.

Example 1: upper() a method that belongs to 'letters'

Example 2: split() a method that belongs to 'letters'

Example 3: Available methods depends on what you have


2.8 | Python Lists and numpy Arrays

Althoug they look similary each have different features

Example 1: Selecting elements that satisfy a criterion

Example 2: Adding a number to an array

Example 3: Growing a list

2.9| Accessing elements of lists and arrays

Examples 1: Selecting one element (indexing)

Examples 2: Selecting a range of elements (slicing)

2.10 | Getting Help