Golang, Python

Building a quiz with a time limit in python and golang

In this article, I am going to go through how we might create a terminal based quiz application where we ingest a CSV with quiz questions and answers, accept an answer from a user (and confirm if it’s correct) while doing a countdown to make sure they don”t exceed a specified time limit. In the […]

Read more
Golang

Saving data to MySQL in Golang

Of course, when we’re doing our data analysis reading from and writing to a database is super important. In this article, I am going to cover how we do that with MySQL. We’ll start at the most simple level and progress up to more complicated methods. In this first example, we make the database connection […]

Read more
Golang

Golang: Getting started with dataframes

In this article, we’re going to look at the qframe library to bring CSV data into a dataframe for simple data wrangling. This file: Imports the relevant packages Defines the file we are going to open (in this case emp.csv) We then use the ioutil library to read the file in. This gets ingested as […]

Read more
Golang

Golang: Go-routines and channels

Typically, if we ran a loop through a number of items, they happen serially (one after the other). But, something cool about Golang is the ability to run Go Routines. We have the main routine by default and everything will sit within that routine. But, we can add concurrency to our scripts by spawning new […]

Read more
Golang

Golang: the HTTP module for get requests

Making HTTP requests in Golang is pretty simple, I’ve included a code sample below. Within the main function we define two new variables (resp and err). The HTTP get function returns the response; which is the response header and any errors that may occur. We then handle the errors – if we find that an […]

Read more
Golang

Golang: everything you need to know about maps

Maps are pretty similar to dictionaries in Python. In the below, I define a map called red_paints. In this map, I detail the name of the specific red colours for a few companies. When we define the map, we use map[string] string, which means: map[ where they keys in the map are of string type] […]

Read more
Golang

Golang: Writing test cases in Go

In this article, we’re going to look at how we write test cases in Golang. Here, I will create a file called acct_test.go; which can be run by simply typing go test into the terminal. The first function tests the creation of a new account. Inside this, we make check the length of the new […]

Read more
Golang

Golang: Getting to the Pointers

Golang uses memory management for our variables so updating values in our structs as we defined in the previous article, doesn’t necessarily work as we expected. Let’s say we have the below, this piece of data will be stored in a particular memory address, let’s say, address 001. When we pass this object to a […]

Read more
Golang

Golang: Getting started with structs

A struct is a data type in Golang, it can also be compared to a class in an object oriented programming language. A struct gives us the ability to set specific fields for a type of data. For example, if we have a struct called Employee, we would have defined fields of: first name, last […]

Read more