Objective
Create a Python program that shows a ranking in pages using LIMIT and OFFSET in the query. Use an in-memory database with the sqlite3 module (sqlite3.connect(":memory:")).
Instructions
- Create the table
rankingwithplayer(text) andpoints(integer). Readnlines withplayer pointsand store them. - Read the page size and the page number (starts at 1). The total number of pages is
n / sizerounded up. - Show
Page p of t. Then query the players sorted by points descending (and by name on ties), withLIMITandOFFSETas parameters. - Show each row as
position. player - points points, where the position follows the global numbering of the ranking.
5
zoe 50
ana 70
leo 50
bea 90
mia 10
2
2
Page 2 of 3
3. leo - 50 points
4. zoe - 50 points
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise