kioku-space

As a personal memory space.

Python Quick Guide - Step 1: Basic Syntax and Data Types (3) - str, bool, None

Info
  • This course is designed to help you learn the basics of Python programming as quickly as possible through hands-on practice.
  • The “Style Guide” sections primarily cover guidelines from PEP8 for writing clean Python code.
  • You can run and see the results of each code example.
    Feel free to experiment with the code - reloading the page will reset the content.

This is a continuation of “Step 1: Basic Syntax and Data Types”.

Python Quick Guide - Step 1: Basic Syntax and Data Types (2) - int, float

Info
  • This course is designed to help you learn the basics of Python programming as quickly as possible through hands-on practice.
  • The “Style Guide” sections primarily cover guidelines from PEP8 for writing clean Python code.
  • You can run and see the results of each code example.
    Feel free to experiment with the code - reloading the page will reset the content.

This is a continuation of “Step 1: Basic Syntax and Data Types”.

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

Info
  • This course is designed to help you learn the basics of Python programming as quickly as possible through hands-on practice.
  • The “Style Guide” sections primarily cover guidelines from PEP8 for writing clean Python code.
  • You can run and see the results of each code example.
    Feel free to experiment with the code - reloading the page will reset the content.
  • 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.