I’m new to Python and I need your help for a problem.

I’ve a variable « a ». With some integer multiplication between « p » and « z », I would find the nearest multiplication of « a ». After z=z-1 and we try it with the same process while z>=1. But I don’t know how to say that for Python!!

Here is my code :

```
def base(a,m):
if m = 2:
return bin(a)
if m = 16:
return hex(a)
some_times = m - 1
while a != 0:
while o < a:
i = i + 1
o = m^i
p = m^(x-1)
if o < a:
#I am blocked here, I would say something like that : while p * some_times isn’t nearest of a : some_times= some_times - 1
list.append(p)
# nb_list.append(the number that we find where I’m blocked)
a = a-p
# I haven’t finished my code yet, sorry !
```

Thank you for your help

Cordially