kioku-space

As a personal memory space.

Python Interactive Guide - Step 1: Basic Syntax and Data Types (1) - Comments, Screen Output

Info
  • This course, Python Interactive Guide, is designed to help you learn the basics of Python programming through hands-on, interactive examples.
  • The “Style Guide” sections introduce clean coding practices, mainly based on PEP8.
  • You can run and experiment with every code example.
    Feel free to try things out - reloading the page will reset everything.
  • Lines beginning with a hash symbol (#) are interpreted as comments.
  • Comment lines do not affect the execution of the program but are used to explain how the program works.
  • Everything from the hash symbol to the end of the line is considered a comment.
Style Guide
  • After the #, add 1 space before beginning your comment text.
  • When adding a comment after a code statement, include at least 2 spaces between the code and the comment.
  • To display data on the screen, use the print function.
  • Strings are enclosed in double quotes (") or single quotes (').
  • By default, the print function inserts a newline at the end.
  • If you don’t want to include a newline, specify an empty string ('') for the end parameter.
📚 Exercise

Output the string “Hello, World!” in a single line by using two print statements - one for “Hello,” and one for " World!".

I Created a Python Code Playground

I created a Python Code Playground that allows you to execute Python code in a web browser.

Python Code Playground

Technically, it uses Pyodide and Monaco Editor, and was created with the help of GitHub Copilot.
(Recent LLMs are very convenient as they can generate working code just by describing what you want to do.)

I created this tool because I thought it would be convenient to have an easy-to-use execution environment when writing Python-related articles on this blog.

Text-to-SQL with LangChain (2) - Agent

Continuing from last post, we’ll explore the implementation of ‘Text-to-SQL’, where you can query database information in natural language and get answers, based on LangChain’s Quickstart documentation.

In this post, we’ll look into the operation of an agent created using the create_sql_agent function.