Continued the Udemy intro course which covered some more string operators and replacement fields.
I learned:
If you make a list of string items, you can call the index of an item and then call a specific character within that item by putting two brackets back to back (ex: mylist[1][3]). You can multiply lists or strings which essentially prints that many copies of them, but you can’t add a value unless you convert it into a string first.
One efficient way to combine strings and other data types is to use .format(). This allows you to input anything by setting up a new index value of items. For instance:
print(“hi i’m a number {0} and i like {1}”.format(3, “five”))
I now realize that the above code I wrote earlier is very stupid. But who would ever read this… aside from my parents if I ever end up telling them I have a blog.
Alas, that’s for another day.