Python Introduction
Set up and run a Python file, trace values through a small program, format output, and diagnose the first common errors.
Python is a general-purpose programming language designed to make a program's intent easy to read. You can use it to automate repetitive tasks, analyze data, build web services, test software, and create command-line tools. In this course, every new idea starts with a small program whose inputs, transformation, and output you can explain.
Learning goals
- Identify the role of a Python source file and run it from a terminal.
- Read a simple program as input, transformation, and output.
- Store text and numbers in well-named variables.
- Use an f-string to turn calculated data into a readable message.
- Read the final line of a traceback to find the kind of error Python found.
How a Python program runs
A Python program is plain text saved in a file ending in .py. When you run that file, the Python interpreter reads it from top to bottom, evaluates expressions, stores values under names, and performs visible work such as printing a message. That simple sequence is the foundation for every larger program in this course.
# Check that Python is available
python --version
# Create a file named progress.py, then run it
python progress.py
# On some Windows installations, use this launcher instead
py progress.pyShell blocks are checked in the browser and never receive access to SovranCode servers or your device.