Many of us who are familiar with programming languages like C, C++ etc. will have an answer like “String is a collection or array of characters.”

Well in Python also, we say the same definition for String data type. String is array of sequenced characters and is written inside single quotes, double quotes or triple quotes. Also, Python doesn’t have character data type, so when we write ‘a’, it is taken as a string with length 1.

Moving on with this article on what is String in Python?

How to create a string?s = 'Hello'


s1 = "Hello"


Python is an object-oriented language and almost every entity in Python is an object, which means that programmers extensively use classes and objects while coding in Python. Objects in Python are basically an encapsulation of Python variables and functions, that they get from classes.

What Are Classes and Objects in Python?

A class is simply a logical entity that behaves as a prototype or a template to create objects, while an object is just a collection of variables and Python functions. Variables and functions are defined inside the class and are accessed using objects. These variables and functions are collectively known as attributes.
Let’s take an example to…

Flex means flexible box.

The flex CSS property specifies how a flex item will grow or shrink so as to fit the space available in its flex container.”

So overall flex provides you the way to make your content flexible/responsive according to your view, you can position your elements upside down and anywhere on your page, whether it is the requirement to align your content in the center of the screen or anything else.

So flex has so many properties here we’ll talk about some major ones, with examples.

  • Aligning the elements on the view
  • Justifying your content on the…

Before discussing slice notation, we need to have a good grasp of indexing for sequential types.

In Python, list is akin to arrays in other scripting languages(Ruby, JavaScript, PHP). It allows you to store an enumerated set of items in one place and access an item by its position — index.

Let’s take a simple example:

>>> colors = [‘red’, ‘green’, ‘blue’, ‘yellow’, ‘white’, ‘black’]

Here we defined a list of colors. Each item in the list has a value(color name) and an index(its position in the list). Python uses zero-based indexing. …

Pawan Kumar Maurya

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store