Python Problem about lucky numbers

I couldnt understand what to do and I did not understand how to write the codes, help me please