How can I turn this code into a Python script?

  algorithm, python, sorting

our teacher gave us an IT task for a sorting algorithm and i wondered how I could transfer the code into a python script?

for i: = 1 to n - 1 do
   for j: := i + 1 to n do
      if a[j] < a[i]
      "swap"(a[j], a[i])

(the "swap" part isn’t actual code, hence the quotation marks – its just what would happen there)

Source: Python Questions

LEAVE A COMMENT