This is another quick article in which we are going to see how to do a conversion of a string into a list of characters in a single line in Python.
Continue readingPage 13 of 55
There are a lot of built-in methods that you can use to do a lot of manipulations with strings in Python.
You can convert them into lists, convert them from one case to another, or split them into partitions.
One such method is the opportunity to partition strings.
Continue readingTuples represent an immutable data structure that can be used to store an ordered sequence of data.
Once you initialize them, you cannot change their values.
Let’s see an example of a tuple:
Continue readingIf you have solved some sort of coding challenges online that have to do with lists, you know that you usually need to have access to indices and also elements in it.
You may also have to do that while you are working on your tasks.
Continue readingWhen you are about to use dictionaries, you may have cases when you try to access elements using keys that are not part of the dictionary.
Let us see the following example:
Since the key “age” is not in there, an error will be thrown.
Continue readingPython 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 readingWhen you create a new array in Java, you can set up the length of it. If you are programming mostly in Python these days, then you may not be aware that you can also do that in Python.
Let’s say that we have a fixed number of students and we want to save their heights in a list.
We can of course just declare an empty list and save their heights by appending new elements to the empty list.
Continue readingStrings 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 readingIt can be quite common that you have to work with a list:
- You may get a list of products from an API call
- You may get a list of people from a database
- You may get a list of items in an online store by reading from a CSV file
- You may get a list of numbers from a range
The list goes on.
Continue readingOne task that you may have to do from time to time is to convert a string into a list of values.
This may be done in different forms, but in this article, we are going to see 2 ways.
Continue reading