Counting by Tens to 1 Million

Edit: I originally posted the RANGE function going to 1000000. Python does not include the last number (e.g., from 1 to 5 goes up to 4). The functions have been updated to use 1000001.

The other day, Astrid said she could count to 1 million by tens. She started off and got to 100, but then skipped up to 200. When she got to 1,000, she started going by thousands. Then she needed help. I told her she wasn't counting by tens any more, and that it would take a really long time to get to 1 million counting by tens.

Today, Astrid and I sat down and wrote a program in Python to count to 1 million by tens. Here was the first version of the program:

for i in range(0, 1000001, 10):
  print(str(i))

This program sets up a variable named 'i' and executes a loop for every value between 0 (first argument to RANGE()) and 1000001 (second argument, which is not included, so we have to go past our target) by 10 (third argument). Then it prints the number after converting it to characters (STR() function), like the text you're reading now.

Python was so fast that the numbers just rushed by in a blur on the screen. It didn't give us a good sense of the size of this task. For our next attempt, we decided to write it to a file. Here's the new program:

with open('numbers.txt', 'w') as f:
  for i in range(0, 1000001, 10):
    f.write(str(i) + '\n')

This program sets up a file first, named numbers.txt, with write ('w') access, and names it 'f'. Then it repeats the same process as in the first program, but instead of printing the number, it writes it to the file (f.write() function / method). So that the file is readable, we have to append (+) a line ending ('\n', what is inserted when you hit ENTER on a keyboard).

Below is a sample of the output.

# Output:
0
10
20
30
40
50
60
70
80
90
...
999900
999910
999920
999930
999940
999950
999960
999970
999980
999990
1000000

Finally, we wanted to get an estimate of how long this would take to read. At first, we just opened the file and scrolled through it. However, it was so big that the scroll bar on the right of the text editor program barely moved! So then we thought maybe we'd see how many pages it would be if we printed it.

That's where the computer started to have trouble! It said it was working on the print preview for a while. I opened the task manager and showed Astrid the "workers" - CPUs - on the computer (4), and how the chart showed a lot of work was going on when the line was drawn toward the top. It appeared like the CPUs were "getting tired" and telling another CPU to help out, one at a time. Kind of strange!

We also looked at the computer's "work table" - RAM - and how if the line was toward the top, it was taking up a lot of room to do the work. Working on the print preview did not take up any space on the work table, though, so it was flat at the bottom.

After waiting for a bit, we decided that this seemed like too much work to ask the computer, so we cancelled the print preview. I guessed that the number of pages would be like a thick book. At that point, Astrid was losing interest, so we concluded our little counting / programming play.

As I'm writing this post, I ran the print preview on a more powerful computer and got an estimate of the number of pages. 1,563!!!

P.S. I was running Python 3 on Ubuntu 20.04 GNU/Linux with the GNOME desktop.

Lost Ladybug

Last week on May 11, the world lost a lovely person.


 

Carla (Weffenstette) Demp died from complications related to her lifelong condition, cystic fibrosis (CF).

Carla was an intelligent, beautiful, vibrant, sparkly woman.

To my children, she was "Auntie Carla". To me, she was a dear friend, a sister, a part of my family, a part of my heart and soul.



Carla loved to quote songs to express her feelings. Here's a bit of how I feel about her using words from "A Case of You" by Joni Mitchell: 

Oh, you're in my blood like holy wine
You taste so bitter and so sweet
Oh, I could drink a case of you, darling

I remember that time you told me
You said, "Love is touching souls"
Surely you touched mine

I didn't have enough time with her. There weren't enough dances, enough trips to Hawai'i, enough smiles and laughter. I didn't give her enough paper flowers to get to "sixty-five roses". I didn't have enough time to talk to her, to learn more about her. I could drink a few more cases of you, darling.

I'm so thankful, though, for the time we had. My life is so much better because she was in it, and I think that's true for my family too. She brought with her other wonderful people as well: Her father, "Grandpa Bruce"; her brother Darin; her love George; and lots of friends we would have never met if not for her. We've been truly blessed she was our friend, Auntie, sister.

From a song named "Sparkle" from Your Lie In April:

All I wanted to see is your smile,
And have your beauty color my world in pastel once more
Recalling the memories that welled up inside me,
I let out my feelings, hoping they'll reach out to you far away

All I want to hear is your voice,
And have it resonate undulatingly throughout me once more
And the times we spent together,
Are all irreplaceable in my heart
I'll treasure these memories you gave me
Thank you

Today

Hi here, Luca writing. Today has been boring, boring, boring. All I feel like doing is a Rubik's cube. But mom had stuff to do. #:(

Violet Evergarden

Luca and I have been having a "guys night", where just him and I spend time together. Usually we play Minecraft, watch a show, play a board / card game, go out for a treat, or something like that.

For a few weeks, we've been watching Violet Evergarden, an anime about a young woman who has difficulty with emotions, both expressing and identifying. While not explicitly autistic, she does have autistic attributes, like the difficulty with emotions. So I think her struggles resonant with Luca, and it provided a good opportunity to talk about these issues while providing experience of another person with the same difficulties.

The show also provided him an opportunity to see me get emotional - many of the episodes are tear-jerkers for various reasons. At times, I noticed him looking at me to see what I was expressing. Usually young children do this to understand and model emotions, and Luca is just doing this now.

One of those moments was in the special episode ("episode 14"), where Violet is asked to write a love letter for an opera. The lyrics are very touching and remind me of people I've lost, to death and other circumstances, including our foster child. I think I might print out some of the lyrics and post it on our memorial wall. I couldn't find them online, so I thought I'd post them here. (If you haven't seen the show, I highly recommend it.)

Letter from Marietta to Modesto
Just listening quietly,
To the wind in the sky,
Together.
[But] you're no longer here with me.

But the words I've written,
Over and over,
Have flown as if they were feathers
And disappeared.

Love is always
In a sunshine-filled place
Even if I can't see you,
Can't touch you,
It's like you're by my side.

[woodwind solo]

Just softly speaking,
[The] trees in the forest
[In] the rain,
As if to cheer me up.

Walking upon
The yet damp
Ground,
A road to be.

Love is always
Like looking through clear water.
Go to accept it,
And it leaves,
Just like you.

[instrumental]

Love is always
In a sunshine-filled place.
Even if I can't see you,
Can't touch you,
It's like you're by my side.
We remember those who have left us, and cherish their memories. They are a part of us, and made us who we are.

Day

Hello, Luca writing. Today I had a water balloon fight with Mom and Astrid. I also made origami roses with Dad. For nap time we all (except Dad) had to rest in Mom's room because Dad was putting up ceiling fans up.