From the course: Programming Foundations: Fundamentals

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Working with strings

Working with strings

- Let's talk about strings. In programming, whenever we have to deal with text, be it an email address, someone's name, or even an emoji, we use strings. The name comes from the fact that it's a string of characters one after the other. The characters can be letters, numbers, symbols, and even spaces. They're typically represented by beginning and ending quotes. Strings can be passed directly to functions or they can be stored in variables. For example, we can use the print function in Python to display a message on the screen, like, "Hi, there!" Notice that we have the opening and closing double quotes. These let Python know it should print out the characters in between the quotes just as we've typed them. We could also define a variable which contains the same string and we'd get the same result. In fact, with Python, we could use single quotes to create a string as well. But you might be wondering why would I want…

Contents