Session 1 of the DSMP Python track → the very basics.

1. Python Output

print() displays things on the screen.

Text (strings) must be inside quotes. Numbers, decimals, and booleans don't need quotes.

print('Hello World')   # Hello World
print(7)               # 7
print(7.7)             # 7.7
print(True)            # True

Without quotes, Python thinks the text is a variable/command and breaks:

print(salman khan)     # ❌ SyntaxError: invalid syntax

Printing many things at once → separate them with commas. By default they're joined with a space:

print('Hello', 1, 4.5, True)   # Hello 1 4.5 True

sep changes what goes between the values:

print('Hello', 1, 4.5, True, sep='/')   # Hello/1/4.5/True

end changes what goes at the end of a print. Normally every print ends with a new line:

print('hello')
print('world')
# hello
# world

print('hello', end='-')
print('world')
# hello-world

One thing to remember throughout: Python is case-sensitive (Printprint).

2. Data Types

The kinds of values Python can store: