Programming with Python: Strings

Talking to Your Computer

Hello! Before we go further into our CodingBat practice, I think it would be beneficial to learn more about strings in Python, something I probably should’ve gone over earlier. So, this post will explain what strings are and how we can interact with them.

What are Strings?

Strings are basically a sequence of individual characters. As we already know, to declare a string in Python we enclose it in quotations, like « Hello World ». To declare a variable as a string, we would just type in:

my_string = "Hello World"

Now, let’s talk about what strings really are. Although strings have their own data type, in reality strings are actually lists of individual characters. Consequently, we are able to interact with strings in some of the ways we did with lists. For example:

View original post 699 mots de plus


Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:


Vous commentez à l'aide de votre compte Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )


Connexion à %s