Strings in Python

Previous
Next

Introduction:

  • String is a one dimensional character array.
  • Strings are objects in Python.
  • String object in python providing pre-defined functionality to perform all string operations in python.

String Literals:

  • In python, we can define strings using single quotes & double quotes.
s1 = "Hello"
s2 = 'World'
print(s1,s2)

sym = '$' #String of length 1
print("Symbol is :",sym)

Multiple Assignments: You can assign values to multiple python variables in one statement.

a=b=c=5
print(a)
print(b)
print(c)

Previous
Next

Add Comment

Courses Enquiry Form