print() to display output, and diagnosing common syntax and runtime errors. Pause the video or step away from distractions when you need to concentrate — this is a practical exercise.
By the end you will:
- Create and run basic Python scripts.
- Use
print()to display text and blank lines. - Identify and fix common syntax and runtime errors.
Prepare the editor (no install required)
Open a new browser tab and launch the KodeKloud Python Playground: The Playground provides a VS Code–style IDE in your browser. Typical layout:- Explorer (left) — your project files.
- Editor (center) — write and edit code.
- Terminal/Console (bottom) — run scripts and view output.
1) Your first script: hello.py
Create a new file namedhello.py (the .py extension indicates a Python file). Add this content:
printis a built-in function that displays text in the console.- Parentheses
()enclose the function arguments. - Quotation marks
"denote a string literal. - The text inside the quotes is printed to the console.
2) Build a small dashboard: dash.py
Createdash.py and add a simple header and greeting:
dash.py:
print() produces a blank line and improves readability.
Using
print() without arguments prints a blank line. This is handy for spacing your output for readability.3) Common errors: how to read and fix them
Errors are part of learning. Two common classes are syntax errors and runtime errors.Syntax error (example: missing quote)
If you omit a closing quote, the editor (VS Code) often highlights the issue and shows a problem in the Problems panel. Faulty code:Runtime error (example: wrong case)
Python is case-sensitive. If you accidentally capitalizeprint as Print, the interpreter will raise a runtime error:
Faulty code:
print.
Python is case-sensitive:
print is different from Print. Always use the correct case for functions, variables, and keywords.Quick reference: commands & tips
Recap
- You wrote and ran Python scripts using
print()to display text. - Use parentheses for function arguments and quotes for strings.
print()with no arguments prints a blank line.- Syntax errors (missing quotes, unmatched parentheses) are often flagged by the editor.
- Runtime errors (wrong case, undefined names) show up when running your program; read tracebacks to locate the problem.
- Practice using variables next to store and display data.
dash.py so you have a local copy. If your playground session ends, you can upload the file back into the Playground later.
Further reading:
- Python official docs: https://docs.python.org/3/
- KodeKloud Playgrounds: https://kodekloud.com/playgrounds/playground-python