What is the meaning of a string in coding?
Introduction
Hello there, coders! This was definitely one of the weirdest concepts I had to understand when I was learning to code.
It is so simple, but I spent an entire evening understand strings! It was very embarrassing, but at least I know now!
To hopefully regain my pride, I'm going to explain what strings are in programming as a beginner.
What even are strings?
You can type in your code editor to turn a certain variable or a number into a string, in our case 9, by using the str() function. You can put anything in there and it will turn into something you can print out! You can't perform math on the string '9' though.
My Experience
Aside from the usual data types, I was a bit stumped when I reached the string functions. There were just so many string functions, like the lower, upper, and especially the slicing.
The way I just got better at understanding strings and just the string functions in general, was just practice. Practice, practice, and practice.
(p.s. strings are present in every programming language!)
Conclusion
Today, we found out that strings are just text that can't be added and every other data type can be turned into a string by using the str() function.
There are many other types of string functions that might seem useless but it can be used to extract data from internet forums, documents and the entire internet!
For example, in this code (in the python for everybody course), I made this code to extract a number from a string!
For example, in this code (in the python for everybody course), I made this code to extract a number from a string!
https://docs.python.org/3/library/string.html
Man, I don't wanna learn these when I become better, but I'll take my time!
By the way, I have so much more beginner-focused python blog posts! Be sure to check 'em out!
How did you all get stuck on strings? And how did you get over it? Comment down below!
and with that,
signing off,
Stewie
This comment has been removed by the author.
ReplyDeleteBucchero and Terracotta: the classic blends with experimentation and the handmade terracotta and bucchero, noble materials with a long tradition, live new lives with Krei
ReplyDeleteExtravega, is a General Contractor licensed in Westchester. Design & Build firm, Architecture, Interior Design, Engineering, Project Management, General Contractor Licensed in Westchester.
ReplyDelete