Skip to main content

Posts

Showing posts from February, 2021

3. Strings

 Strings String is a data type in python. String is a sequence of characters enclosed in quotes. We can primarily, write a string in these three ways : Single quoted strings ➡️ a = 'Aariz' Double quoted strings ➡️ b = "Aariz" Triple quoted strings ➡️ c = "'Aariz"' String Slicing A string in python can be sliced for getting a part of the string. Consider the following string: name = "Aariz"                                    ➡️ length = 5               ↑↑↑↑↑               01234                The index in a string starts from 0 to (length-1) in Python. In order to slice a string, we use the following syntax: sl = name[int_start:int_end]                       ↙️            ↘️ first index includ...