Python — Variables and Strings.

What is python?

Features of python:

Interpretation in python:

Python — Variables:

Variables are reserved storage in the memory. when you declare a variable, you reserve some space for it in the memory. It may vary according to the data type of the variable.

Rules for creating the variable:

There are certain rules while creating/declaring a variable, which is mentioned below:

  • A variable name cannot start with a number.
  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0–9, and _ ).

Python — Strings :

Strings in python are nothing but immutable arrays. They can be surrounded by either single or double quotation marks.

String Indexing:

As basically string is an array its indexing starts from zero and square brackets can be used to access the elements of the string.


You can return a specific range of characters by using the slice syntax. mention the start index and the end index, separated by a colon, to return a part of the string [start: end].


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