Check the installation

python3 --version

Start the interpreter with python3, or create a file such as hello.py:

print("Hello, DedSec Smartphone Academy!")

Run it with:

python3 hello.py

Comments and indentation

Comments begin with #. Python uses indentation to define code blocks, so consistent spaces are part of the syntax.

name = input("Name: ").strip()
if name:
    print(f"Welcome, {name}")

Errors are information

A traceback shows where a program failed and which exception occurred. Read the final line first, then inspect the referenced line of your code. Do not hide every exception with a broad except; handle only errors you understand.

05 · Python Basics

Continue learning

Back to Smartphone Academy