NO STRINGS ATTACHED

--Originally published at Coding The Future

Photo by Everton Vila

Hey everyone! It's been so long since my last post, but trust me, there's reasons for my absence and I am back with exiting stuff.

To begin today's topic, I have another of my quick stories... Lately, my life has been overtaken by discernment confusion on what I want to do, what I must do, and what is expected of me. I don't think a lot people go through this kind of crisis as often as I do, but I think we've all been there at some point in our lives. How is this relevant? Again, it really isn't, but I wish I could just try things sometimes without any strings attached.

Oh, well. That was deep. But now let's focus on strings, yay!

What are strings?

As you may know from my previous posts on types, one of the most interesting and common types in programming languages are strings.

Strings are a literally a chain of characters of any type. So any text-based variable is a string. Strings can include numbers, but these are not treated like numbers, rather like labels. So if you declare two strings like "2" and "4" and try to multiply them, you will get an error, because you can't multiply text! Get it? String is just plain text.

Declaring strings

Declaring strings in Python could not be easier. All you need to do is declare a variable and assign it a value within quotation marks. Take a look:

firstName = "Emanuel"

Now, we can do all sorts of things with this string! We can print it, we can concatenate it (join it with another string), split it, you name it!

How can they be used?

As I just mentioned, strings can be pretty powerful. I know I said you Continue reading "NO STRINGS ATTACHED"