Software engineering and personal development

Tag: python (Page 8 of 10)

How to Iterate a Dictionary in a Single Line in Python

man in black long sleeve shirt wearing black headphones sitting on chair
Photo by Nubelson Fernandes on Unsplash

Python is known to be the language that gives you the ability to write a few lines of code that can do a lot of things.

Just a few Python lines can be enough to pull data from an API that you can then also visualize in a fancy diagram.

Or even a single line of code can be enough for you to do plenty of things.

There are a lot of Python one-liners online that you can find.

Continue reading

How to Quickly Change the Case of Strings in Python

laptop on brown wooden table
Photo by XPS on Unsplash

Strings are pretty common in our day-to-day programming lives. One common task that we may need to do is perform a switch from one case to another one.

Of course, it’s not supposed to be a standalone task in Jira. Rather, it can be just a tiny portion of a larger task. 

Since your time is valuable and you can invest it in more useful things, it is worth knowing that you can do such switches quickly in Python with built-in functions without having you do any implementation.

Continue reading

How to Check Whether 2 Strings Are Anagrams in Python Using Counter

A MacBook with lines of code on its screen on a busy desk
Photo by Christopher Gower on Unsplash

Checking whether a word is an anagram of another one can be a question that is quite common in coding interviews.

If you don’t know what an anagram is, here is a definition:

An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. For example, the word anagram itself can be rearranged into nag a ram, also the word binary into brainy and the word adobe into abode. 

Continue reading

How to Find the First Element in a List in Python Without Using the Index 0

Photo by Chris Ried on Unsplash

One of the most common ways of finding the first element in a list in Python is using the index 0.

I was recently thinking of coming up with a more creative idea and I figured out another way.

It’s not something that you may have not figured out yourself. It also doesn’t mean that someone doesn’t know it.

Still, there is always someone who may also find it helpful or that hasn’t had the chance to have time to think about it.

Continue reading

How to Convert a Natural-language-like String into a Date in Python

turned on gray laptop computer
Photo by Oskar Yildiz on Unsplash

You have probably come across situations in which you needed to convert a string into a date in Python. There are a few ways to do that, but you may have not had the chance to use the following method.

It’s not that it is so special that you cannot learn, or that it is so difficult what’s going on. It’s basically a rare conversion that you have not had the chance to stumble upon before.

Continue reading

How To Find The Index Of An Item In A Tuple In Python

turned-on flat screen TV
Photo by Alexandru Acea on Unsplash

As Python is one of the most popular languages right now, many developers from other languages may also start using it whether that is just on a side project, or a simple script that can help them automate some tasks.

They may have been able to see how to actually find the index in an array, for example in Java, where you write the name of the array and also the index in the brackets. This is also available in Python.

Continue reading
« Older posts Newer posts »

© 2024 Fatos Morina

Theme by Anders NorenUp ↑