Dahlia (and a little bit about Bash programming with kids) :: Daily and Fresh ๐Ÿ“ท (231/366)

avatar
(Edited)

Hello!

This is a photo I am definitely not very content with. I took plenty of shots from different sides of the plant. But still struggled with everything from lighting to composition. I just couldn't seem to get it right. Everything failed.

I feel like giving up.

Changing the subject...

Parenting / Programming Bash

A few days ago I taught Miro some programming, using the Bash command shell. We wrote a number guessing game together. I told him what to write line by line in an editor, and told him what each line will do.

Here's my version of the program:

#!/bin/bash

# Satunnaislukupeli

satLuku=$((RANDOM%100+1))

echo -n "Arvaa luku (1-100): "

while read arvLuku 
do
# echo $satLuku

if [ $arvLuku -gt $satLuku ]
then
  echo "Liian suuri luku!"

elif [ $arvLuku -lt $satLuku ]
then
  echo "Liian pieni luku!"
else
  echo "Arvasit aivan oikein!!!"
  break
 
fi
done

Translations:

"Satunnaislukupeli" = "Random number game"
"Arvaa luku" = "Guess a number"
"Liian suuri/pieni" = "Too large/small"
"Arvasit oikein" = "You guessed correctly"

Miro made some (mainly linguistic) changes to his code though, but it worked too.
He was very impressed about what you can make the computer do.

Should I teach him the same in Python or Javascript? Maybe something else?

See ya!



Weeklies
Weekly and Fresh ๐Ÿ“ธ #32
Weekly and Fresh ๐Ÿ“ธ #31
Weekly and Fresh ๐Ÿ“ธ #30
Weekly and Fresh ๐Ÿ“ธ #29
Weekly and Fresh ๐Ÿ“ธ #28


Like my post? ๐Ÿป Buy me a beer! ๐Ÿป



0
0
0.000
6 comments
avatar

Javascript is used a lot for web programming. As is its similar typescript (used for Angular programming). That would not be a bad thing to teach him. Perhaps some C# as well since it goes hand in hand with the typescript(Angular).

0
0
0.000
avatar

I'm a bit wary of everything corporate, like C#. When it comes to programming languages, the standards should be set by the programming community, and not a corporate entity controlling the language.

Other than that, I'm open to everything. Python is quite excellent, and if I learn this stuff I might even try C/C++. And for Leo/Miro, I wouldn't mind teaching them about algorithms, flowcharts and pseudo-code first. It might help them perceive it a bit more efficiently.

(I had to go that route myself because I got stuck with complexity as soon as I started trying to learn by doing...)

0
0
0.000
avatar

Thatโ€™s a nice photo!! I like it a lot! I could not take photos like that!

Oh! I wish I had a friend teaching me to program too!

0
0
0.000
avatar

Dhalia is looking very beautiful, i am always annoyed with the programming code, it sucks my eyes and head.

0
0
0.000