Skip to main content
Welcome back! This hands-on lesson walks you through writing and running simple Python scripts, using 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.
Example terminal prompt you may see:

1) Your first script: hello.py

Create a new file named hello.py (the .py extension indicates a Python file). Add this content:
Run it from the editor (right-click → Run) or from the terminal:
Expected output:
How this works:
  • print is 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.
Make it personal by changing the message:
Then run:
Tip: When using the terminal, press the Up arrow to cycle through previous commands.

2) Build a small dashboard: dash.py

Create dash.py and add a simple header and greeting: dash.py:
Run it:
Output:
Note: Using an empty 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.
Customize the greeting and add wellbeing and goals sections: dash.py:
Run again:
Expected output:

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:
Running it produces:
Fix: add the missing closing quote and rerun.

Runtime error (example: wrong case)

Python is case-sensitive. If you accidentally capitalize print as Print, the interpreter will raise a runtime error: Faulty code:
Run it:
Traceback:
Fix: use the correct lowercase 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.
Before finishing, download your customized 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: Good luck — complete the lab to practice and solidify what you’ve learned!

Watch Video