Bachelor Back-end Development

In April 2020 I started a Bachelor in Back-end Development at Winc Academy, which focuses on Python, SQL and DevOps. Update: I succesfully finished the course in June!

During the course I’ve succesfully finished the following assignments:


From the class:

from barcode import EAN13 as ean13
from barcode.writer import ImageWriter

from os import makedirs
from os.path import abspath, exists

import random

import config

from functions.export import make_missing_dir

class Barcode():
    """Generates a valid EAN13 barcode with checksum
    Stores a barcode image in PNG-format to a barcodes directory
    for use in supermarket product display and Cash register

    def __init__(self, prefix):

        # check prefix type
        if not isinstance(prefix, (str, int, list)):
            raise TypeError('Only string, list or int allowed')

        # convert int or str of digits into list of digits
        if isinstance(prefix, (str, int)):
            prefix = list(str(prefix))

        # start new ean code with up to 12 digits from prefix
        code = []

        if isinstance(prefix, list) and len(prefix) > 0:

            for digit in prefix:

                # if code = 12 digits, break
                if len(code) >= 12:

                # if digit is int, append
                if isinstance(digit, int):

                # if digit is str and is a digit, append as int
                elif isinstance(digit, str):
                    if digit.isdigit():
                        digit = code.append(int(digit))
                        # raise TypeError if digit is some other character
                        raise TypeError('Only digits allowed')

        # add up to 12 random digits to complete code
        while len(code) < 12:
            code.append(random.randint(0, 9))

        self.prefix = prefix
        self.code = code
        self.checksum = [self.__calculate_checksum()]
        self.ean = ''.join([str(digit)
                           for digit in (self.code + self.checksum)])

        # generate barcode image

    def __str__(self):
        return self.ean

    def __generate_barcode_image(self, ean=''):

        if ean == '':
            raise ValueError('A string of 13 digits is required')

        directory = config.BARCODES_DIR
        filepath = abspath(f'./{directory}/{ean}.png')

            with open(filepath, 'wb') as f:
                ean13(ean, writer=ImageWriter()).write(f)

            raise Exception(
                f'Unable to save barcode to file ‘{filepath}’')

    def __calculate_checksum(self):
        odd = sum(self.code[0::2])
        even = sum(self.code[1::2]) * 3
        unit = (odd + even) % 10
        if unit != 0:
            return 10 - unit
        return 0

def main():

if __name__ == '__main__':


Certificate Back-end Development


You may also like:

Back-end Code Example

Schedule From the&nbsp;schedule.js&nbsp;node.js file: 'use strict' const {SCHEDULE} = require('../configuration') const schedule = require('node-schedule') const every_six_minutes = '*/6 * * * *' const every_seven_minutes = '*/7 * * * *'...

Bachelor Front-end Development

In March and April 2020 I followed a Bachelor in Front-end Development at Winc Academy, which focuses on HTML5, CSS3, JavaScript ES6+ and React JS. During the course I’ve succesfully...