Skip to content

CS1010s

AY 2024/25 Semester 1

This website hosts the lecture notes, lecture slides, and other written guides about CS1010S. You can explore the links on the menu on the left, or search for keywords in the search bar above.

Usage

Codes

Codes are written in monospace font with Python specific syntax highlighting. While we try to match the syntax highlighting to IDLE, it may not perfectly match what you will see on IDLE.

Additionally, we provide a REPL playrgound on this website for you to quickly check the execution of Python codes. This REPL is powered by Pyodide. You can find this on the top right hand corner with the symbol .

To check the step-by-step execution, you can also use Python Tutor. Again, this is also available on the top right hand corner of the website.

Codes may also be given in code boxes. An example of a code box is shown below.

# This is a comment
course = "CS1010S"

You can copy the code in code boxes using the copy button available on the top right hand corner of the code boxes. We separate the kind of codes we give into two kinds:

  1. Code intended to be run on REPL. This kind of code will be boxed with the symbol . Unfortunately, this kind of code cannot be easily copied due to the presence of the prompt >>>. As such, you will need to manually copy each code.

    Example of REPL Code

    >>> "It has prompt"
    'It has prompt'
    
  2. Code intended to be run from file. This kind of code will be boxed with the symbol . You can use the copy button to copy the code. To run the code locally, you need to save the code into a file stored locally on your computer.

    Example of File Code

    note = "It has no prompt"
    print(note)
    

Notes

Firstly, notes are categorized into units and subunits. Units are the outer-most branches of Notes (e.g., Expressions) that consists of one or more sub-units (e.g., Values within Expressions). Within each sub-units, we further classify the content into sections where each section is delimited by its header (e.g., Types within Values within Expressions). Again, sections may be further split into subsections (e.g., Boolean within Types within Values within Expressions).

  • Units
    • Sub-units
      • Sections
        • Subsections

Note that the units, sub-units, sections, or subsections that begins with "✢" in its name are optional but good to know. The content may be referred to in other parts, but a direct link to the relevant part will be given.

To help you focus on important components, we will try to put important information within boxes. You have seen two examples of boxes for codes. Here, we will describe additional boxes. If the boxes are initially closed, the information is optional for the course. Otherwise, you should treat the information as relevant for the course.

Learning Objective

This describes the overall objective of the subunit.

Information

This describes relevant information.

Summary

This describes summary of information for sections/subsections.

Warning

This is a warning. Try to avoid what is written here.

Additional Information

This describes additional information that are nice to know and may help us.

Dangerous

This describes bad practices or common mistakes. You must avoid doing this.

REPL Code

Typically contains code box that can be run on REPL.

File Code

Typically contains code box that can be run from file.

Review

This contains questions for review. Questions are typically given as MCQ (only one answer) or MRQ (have multiple answers).

Question

This contains programming questions. We will describe programming questions in terms of (a) problem description, (b) task, (c) assumptions, and (d) restrictions. We may omit (c) and (d) if they are not needed.

Hints

We will provide one or more hints for early programming questions. They are hidden inside here.

Individual Hint

Each hint will be hidden inside here. The answers will be given in a separate tab to allow you to look at the hints and try to answer the hints on your own.

In some cases, we may give good and bad solutions/examples. You can differentiate them by looking at the box.

Good Solutions/Examples

This is good.

Bad Solutions/Examples

This is bad.

If an open notes have tabs, the content of all tabs are relevant for the courses. The may contain additional explanation or to group examples into one logical grouping. Click on the name on the tab to see additional relevant information.

This is relevant.

This is still relevant.

You may use the following shortcuts to navigate:

  • N: Next units/sub-units
  • P: Previous units/sub-units
  • /: Search