Python Day 19 – I know what it does, but not how to do it

Still stuck on those practice problems…

(for reference right now I’m trying to figure out how to only output all the even numbers of a numpy array)

I learned:

I now know what % does! It takes the remainder, or ‘modulo’, of a number. For instance 5%2 = 0.5. The function itself is also called a modulo (or sometimes string formatting in rare contexts). I learned this from this article/video.

A little frustration:

When reopening Jupyter notebooks I’m finding my computer doesn’t remember any of the variables I’ve defined, and that I need to run all the code again. So how does one run all of the code at once? Rather than go through each command box individually.

I’m still confused on:

Formatting!!! I know conceptually that I should be able to run a code that says if the value in an array %2 == 0, then print(value), else don’t print… but I’m running into all sorts of errors that I believe are just me not know how to properly type something. Right now my code looks like:

for i in arrfloat.any():
if i%2 == 0:
print(i)

(arrfloat is the name of the array)

I don’t completely know what “i” is doing there but that’s what someone in a tutorial put. I will likely find the answer in this video... but don’t have the time to because I’m in school and it’s finals season so I’ve got to go do school work :/

I shall return to you soon… and demystify these challenging formatting problems.

Love you Aman.

Leave a Reply

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading