Week 6 – Hello World

This post is part of Linux Servers -course ran by Tero Karvinen

This week, the topic was mainly Python. I started programming with Python and therefore have used it a lot, so there weren’t that many new things to learn for me. Assignment consisted of two tasks, one mandatory and one optional.

The task descriptions are freely translated from the course page

Task a) Write Hello World with three languages. Install required environments.

Python

Python is included in Xubuntu by default, so this was easy to do. I opened the terminal and typed python3, which opened Python shell for me. Then, I typed ‘print(“Hello World”)’ and the following happened:

SQL

SQL probably shouldn’t be used for this, but I guess I was a bit lazy. To write ‘Hello World’ with SQL, I logged into MariaDB and my database, and did a select hello world -query:

Ruby

I probably could’ve done this with PHP, but that would’ve been extra lazy, so I decided to try one new language. So I chose Ruby.

To install Ruby, I used Google to find out what packages I need, and went with the first result, which was Xubuntu Geek’s how-to. The command to get the ruby interpreter was:

sudo apt-get install ruby -y


I then found out that the command to ‘print’ things in Ruby is ‘puts’, so I ran the following command from the terminal:

ruby -e "puts 'Hello world'"

..which gave me the following:

Task b) Optional: With every language you used, write a simple program, such as a “input-processing-output” -program.

I’m leaving this here as a placeholder incase I get an inspiration and decide to do these programs later on, but for now, I’ll leave a link to my small Python-script that I wrote few weeks back. https://tommioffinland.fi/2019/01/29/bullying-phishers-with-python/

References:

Tero Karvinen – Linux Servers course page
http://terokarvinen.com/2018/aikataulu-linux-palvelimet-ict4tn021-3004-ti-alkukevat-2019-5-op

Xubuntugeek – How to install ruby in xubuntu
http://xubuntugeek.blogspot.com/2012/08/how-to-install-ruby-in-xubuntu.html

Wikibooks – Ruby programming
https://en.wikibooks.org/wiki/Ruby_Programming/Hello_world

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close