Software engineering and personal development

Tag: feature

How to Perform Math Operations Inside Strings in Python

In Python, it’s possible to perform mathematical operations inside of string literals, using a feature called “f-strings”. F-strings, or “formatted string literals”, allow you to embed expressions inside string literals, which are evaluated at runtime. This allows you to mix variables, arithmetic expressions, and other computations into strings in a very readable and convenient way.

num_val = 42

print(f'{num_val % 2 = }') # num_val % 2 = 0

Here, the f-string '{num_val % 2 = }' is a string literal that contains an expression num_val % 2. The % operator is used to perform the modulo operation, which returns the remainder of the division of one number by another. In this case, num_val % 2 returns the remainder of the division of 42 by 2, which is 0.

Continue reading

I became a Ruby on Rails and React contributor and you can too

Img source: gennovacap.com

I am really grateful that I have managed to contribute to a few open source projects, including the ones that I currently use on a regular basis: Ruby on Rails and React. My contributions are very minor fixes, and suggestions, and may not be that much worthy of the praise, but I want to use this article to inspire you to go and make your own contributions as well.

One of my core values is contribution and helping others. That’s one of the reasons why I love to write articles, and also contribute back to the very projects that I have benefitted from over the years.  

Although major frameworks that are largely used have gone through tons of reviews and careful analysis over the years, there is always room for improvement or addition. This means that you are not only able to fix bugs, or improve something that is already implemented, but you can also implement new features as well. Continue reading

© 2024 Fatos Morina

Theme by Anders NorenUp ↑