Finding pupils to tutor I am a Math tutor and I found the site https://www.yksityisopetus.fi/ where one can search pupils. I made a Python parser to find pupils that want Math teaching with at least 25 €/hour. Are there any improvements for this code?
import requests
import tkinter as tk

link = &quot;https://www.yksityisopetus.fi/opiskelijat/matematiikka/min-25-per-tunti/uusin-ensin&quot;
f = requests.get(link)
lista = f.text.split('\n')
ilmot = []
for i in range(len(lista)):
    if &quot;&lt;a href=\&quot;/&quot; in lista[i] and &quot;&lt;a href=\&quot;/opettajat&quot; not in lista[i] and &quot;&lt;a href=\&quot;/contact&quot; not in lista[i]:
        if lista[i] not in ilmot:
            ilmot.append(lista[i])
parsittu = []
for i in range(len(ilmot)):
    ilmo = &quot;https://www.yksityisopetus.fi&quot;+ilmot[i].split('&quot;')[1]
    f = requests.get(link)
    f = f.text.split(&quot;&gt;&quot;)
    for j in range(len(f)):
        if f[j] == '\n&lt;br /':
            parsittu.append(f[j+1])
s = &quot;&quot;
parsilmot = []
for i in range(len(parsittu)):
    if parsittu[i].endswith('&lt;/div'):
        parsilmot.append(parsittu[i][0:len(parsittu[i])-5])

p = list(set(parsilmot))
quote = &quot;&quot;
for i in p:
    quote += i+&quot;\n&quot;

root = tk.Tk()
S = tk.Scrollbar(root)
T = tk.Text(root, height=4, width=100)
S.pack(side=tk.RIGHT, fill=tk.Y)
T.pack(side=tk.LEFT, fill=tk.Y)
S.config(command=T.yview)
T.config(yscrollcommand=S.set)
T.insert(tk.END, quote)
tk.mainloop()
Move your code into functions
Functions are easier to test, and make it easier to modify your code over time.
For example, I think the first block requests information from a server and creates a list of links. I think the second block processes that list of links and generates some other sort of list. I think the third block iterates over the list from the second block and generates yet another list.
If these blocks were in functions, then the main logic would be self explanatory. For example, your code could look like:
...
ilmot = get_students(link)
parsittu = some_other_function(ilmot)
parsilmot = another_function(parsittu)
quote = create_quote(parsilmot)
...

If those functions all had reasonable names, the code would be very easy to understand, and it would be easy to test each function in isolation.
Not only that, but you can more easily move all of that code into a function so that you can implement a &quot;refresh&quot; feature into the UI so that you don't have to restart the script every time you want to update the data.