Strings in Python

In the field of Computer Programming, a string is a sequence of characters. In this blog, we will talk about assigning a string to a variable, string concatenation, and different string methods.




#String Literals

String Literals in Python are either surrounded by single quotation marks or double quotation marks. 'Hello World' is the same as "Hello World". We can display the string literal with the print() function.

#Assigning String to a variable

Assigning a string to a variable is done with the variable name followed by an equal sign and a string.

#Multiline String

We can assign a multiline string to a variable by using three quotes. 
eg: 
'''
.......
.......
'''

#Strings are Arrays

Like other Programming languages, strings in Python are arrays of byte representing Unicode characters. However, Python doesn't have a character data type, a single character is simply a string with a length of 1. Square brackets can be used to access elements of the string. Characters start with 0 position.

eg: first_string = "Python"
P = 0, y = 1, t = 2, h = 3, o =  4, n = 5


#String Slicing




#Length of the string




#String Mehods



























#String Presence








#String Concatenation
















#Escape Character















Comments

Popular posts from this blog

Python Syntax, Comment and Variable

Python Booleans

Getting Started With Python