Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

* Scripting Languages
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* aktuális (2023/24/2)
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

20121006e

Advanced sorting

Exercise 1

Consider the following records (list of tuples):

data = [ 
    (1,'Albany','NY',162692),
    (121,'Wyoming','NY',8722),
    (3,'Allegany','NY',11986),
    (123,'Yates','NY',5094)
]

Sort the records by the value of the last column.

Exercise 2

Consider the following list:

users = ['10:User1', '80:User2', '100:User3', '00:User4', '75:User4', '45:User5']

Sort the list by user ID in descending order:

    100:User3
    80:User2
    75:User4
    45:User5
    10:User1
    00:User4

Exercise 3

Consider the following matrix:

matrix = [ [2, 6], [1, 3], [5, 4] ]

Sort the rows of the matrix by the 2nd column:

[ [1, 3], [5, 4], [2, 6] ]
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2023 November 15, 11:08