Advent of code 2024 - Day 06 of 25

The sixth day of Advent of Code was yesterday 06/12/2024! If you’re here for the first time today, don’t forget to read the posts about Day 1, Day 2, Day 3, Day 4, and Day 5.

I classified the sixth problem as medium (part 1) and difficult (part 2).

Tips

  • Again, a maze problem where each character can be seen as an element in a matrix.

  • Since you’ll constantly need to check maze boundaries, valid positions, and obstacles, I recommend creating a class to represent the maze.

Read more

Advent of Code 2024 - Day 05 of 25

The fifth day of Advent of Code was yesterday 12/05/2024! If you’re here for the first time today, don’t forget to read the posts about Day 1, Day 2, Day 3, and Day 4!

I classified the fifth problem as easy (part 1) and medium (part 2).

Tips

  • The problem has two inputs, a list of rules and a list of updates.

  • The pages present in the rules list (X) must be printed before pages (Y). Since the same page X can have multiple Y’s, the rules are a dictionary with integer keys and lists of integers as values.

Read more

Advent of Code 2024 - Day 04 of 25

The fourth day of Advent of Code was yesterday 12/04/2024! If you’re here for the first time today, don’t forget to read the posts about Day 1, Day 2 and Day 3!

I classified the fourth problem as medium (part 1) and hard (part 2).

Tips

  • If you visualize the inputs as a matrix, the solution becomes more natural.

  • Consider that each character occupies a position y, x in the matrix, where y is the row and x is the column.

Read more

Advent of Code 2024 - Day 03 of 25

The third day of Advent of Code was yesterday 12/03/2024! If you’re here for the first time today, don’t forget to read the post about Day 1 and Day 2!

I classified the third problem as easy (part 1) and medium (part 2).

Tips

  • You can use regular expressions to detect mul and extract numbers.
  • In the second part, you can use a simple state machine to enable or disable multiplications.
  • Remember re.compile and re.findall.

How much Python do you need to know?

The chapters refer to my book Introduction to Programming with Python.

Read more

Advent of Code 2024 - Day 02 of 25

Second day of Advent of Code was yesterday 12/02/2024! If you’re here for the first time today, don’t forget to read the post about Day 1!

I classified the second problem as easy (part 1) and medium (part 2).

Tips

  • You need to transform each input line into a list of integers.
  • To determine if the list is increasing or decreasing, calculate the difference between the second and first element. The sign of the subtraction result will indicate if the list should be increasing or decreasing. To check if the entire list is increasing or decreasing, continue subtracting elements, two at a time, until the end of the list. When the subtraction value is positive, the list is increasing. If negative, the list is decreasing. But only if the same sign is maintained until the end of the list.
  • Remember that since we use L[i+1] - L[i], i must be less than the index of the last element, otherwise you’ll get an error.

Example of an increasing list:

Read more

Advent of Code 2024 - Day 01 of 25

The Advent of Code is a programming challenge that takes place between December 1st and 25th each year. The 2024 edition is the tenth event that is programming language independent - you can use any tools you want.

Every day, starting from December first, a new problem is released. Although the name is Advent of Code (Advent is a Christian event that precedes Christmas), the problems don’t necessarily involve religion, but are fun problems with Santa’s elves.

Read more

Python 3.13

Yesterday, Python 3.13 was released, one of the most anticipated versions of the interpreter. The main attraction for me has always been the possibility of running code in Python without GIL (Global Interpreter Lock). The GIL has haunted Python for a long time and has always been a topic of many discussions.

For a long time, there have been attempts to remove the GIL from the interpreter. But what does it block? When we run code with multiple threads in Python, the GIL ensures that common structures in the interpreter are protected between these threads, i.e., against concurrency problems. Several attempts were made, but all left Python slower or only worked for specific cases. A rant by Guido - It isn’t Easy to Remove GIL (https://www.artima.com/weblogs/viewpost.jsp?thread=214235) in response to this post Data Services and Integration, An open letter to Guido van Rossum: Mr Rossum, tear down that GIL! (http://web.archive.org/web/20080907123430/http://blog.snaplogic.org/?p=94). Nothing better than PEP-703 (https://peps.python.org/pep-0703/) to understand how these conversations ended. In reality, they didn’t end, the GIL can be enabled or disabled and each user can choose which version of the interpreter they want to use. Not all is well, as many libraries still need more time to support this option and even stabilize their codes.

Read more

Different IT Careers

As a professional in IT, you have several career options as an employee, freelancer, consultant or entrepreneur (business owner) among others. We will see the advantages and disadvantages of each option and then discuss how to combine them to test various paths before making such an important decision, like which career to follow.

Read more