Python Code Support Documentation

This document explains the current platform's support scope and limitations for the Python language.
Please adhere to the following rules to avoid using incompatible syntax features.

Supported Features

1. Basic Data Types

The following basic types are supported for declaration and use:
str, int, float, bool

Example:

2. Containers

The following containers are supported:

Container TypeExample
One-dimensional arrayarr=[1,2,3]
Two-dimensional arrayarr=[[1,2,3],[4,5,6]]
dictdict={"name":"Alice","age":18}
Queueq = Queue();q.enqueue(1);q.dequeue()
Stacks = Stack();s.push(1);s.pop()

Constraints:

  • Keys and values in dict must be of basic types

3. Built-in Data Structures

The following predefined structures can be used directly:

4. Notes

  1. Do not wrap your executable code in if __name__ == "__main__":. When we execute your code in the sandbox, it is not in the main file, so this if condition will return False. You can directly write the code you need to execute.