dave on Nostr: s = [20, 9, 19, 18, 8, 7, 6] for i in range(len(s)): for j in range(len(s)-i-1): if ...
s = [20, 9, 19, 18, 8, 7, 6]
for i in range(len(s)):
for j in range(len(s)-i-1):
if s[j] > s[j+1]:
s[j], s[j+1] = s[j+1], s[j]
print(s)
Published at
2023-02-08 10:20:55Event JSON
{
"id": "36a7d93004e49ece9697bff675a77b59ad2a9aecc67682abecb2568e5b311db0",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1675851655,
"kind": 1,
"tags": [
[
"e",
"f397ce10e37a95aed067a6fb1e2fe0b3759b000a0edb962c2efecf567a844026",
"",
"root"
],
[
"e",
"c255fa3285d22379b7d42243f227fb9b6c122cbe18418012e296ba30dbbf03b6",
"",
"reply"
],
[
"p",
"905cc11952c8da30f38b441ef7194181a543ebeb6f8afdebccc7fbaeaef0a59a"
]
],
"content": "s = [20, 9, 19, 18, 8, 7, 6]\n\nfor i in range(len(s)):\n for j in range(len(s)-i-1):\n if s[j] \u003e s[j+1]:\n s[j], s[j+1] = s[j+1], s[j]\n\nprint(s)",
"sig": "4fb783b6c939e2de8517ad547ea75e692afba4e586973fe7016c907d3c31c58f59d7f2b80bc892356a55c84f8b1b4c229eba3359158c50a68670a3133ebf67b2"
}