Source: xkcd
Source: Kaggle 2021 State of Data Science and Machine Learning survey
jupyter notebook
New
and select Python
from the drop-down menuInsert
, Insert Cell Below
Code
Markdown
in the drop-down manu on the toolbarFile
and then Close and Halt
Quit
in the upper right corner of your main Jupyter tab (located at http://localhost:8888/
)![]() |
![]() |
Source: Guido van Rossum, Python Software Foundation
import this
The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!
print("Hello World!")
Hello World!
Python programs can be decomposed into modules, statements, expressions, and objects, as follows:
Objects and operators are combined to form expressions. Key operators are:
+
, -
, *
, **
, /
, //
, %
)and
, or
, not
)==
, !=
, >
, >=
, <
, <=
)=
, +=
, -=
, *=
, /=
)in
)1 + 1
2
5 - 3
2
6 / 2
3.0
4 * 4
16
# Exponentiation <- Python comments start with #
2 ** 4
16
# Integer division (remainder is discarded)
7 // 3
2
# Modulo operation (only remainder is retained)
7 % 3
1
3 != 1 # Not equal
True
3 > 3 # Greater than
False
3 >= 3 # Greater than or equal
True
False or True # True if either first or second operand is True, False otherwise
True
3 > 3 or 3 >= 3 # Combining 3 Boolean expressions
True
Assignments create object references. Target (or name) on the left is assigned to object on the rigth.
x = 3
x
3
x += 2 # Increment assignment, equivalent to x = x + 2
x
5
As =
(assignment) and ==
(equality comparison) operators appear very similar, they sometime can create confusion.
x = 3
x
3
x == 3
True
Operator in
returns True
if an object of the left side is in a sequence on the right.
'a' in 'abc'
True
4 in [1, 2, 3] # [1,2,3] is a list
False
4 not in [1, 2, 3]
True
_
or *
for emphasis (single - italic, double - bold, triple - bold and italic)*one*
becomes one, __two__
- two and ***three***
- *three*#
, ##
, ###
, ####
and so on-
, +
or *
1.
(counter is auto-incremented)[some text here](url_here)

Some text in *italic* and **bold**
Simple list:
- A
- B
Ordered list:
1. A
1. B
Formula - $Y = X + 5$
Some text in italic and bold
Simple list:
Ordered list:
Formula - $Y = X + 5$