Blog Details

img
Data Science

What are variables in Python

Spoke Right / 17 Nov, 2023

Python Variables:

Variables are used in python to hold a value at a memory location. Python is a type infer language, i.e the data type of the variables do not need to be declared. It automatically detects the types in accordance with the variable value. Creating a variable is also not a tedious task in python; just need to assign a value to the variable name.

Rules for a Variable Name in Python:

  •  A variable name should not be a keyword.
  • A variable name can begin with a letter or an underscore only.
  • A variable name can contain both numbers and letters along with underscores (A-z, 0-9, and _ ).
  • A Variable name in Python is case-sensitive i.e, sum and Sum are two different variables.

Features of a Python Variable:

  • Python variables can be created whenever required. There is no boundation in declaring a variable in python.
  • Python variables supports multiple assignment in a single statement i.e, user can assign single value to multiple variables or multiple values to multiple variables in a single statement.

Printing “HELLO WORLD” in python using Interactive Mode and using a Variable.

0 comments

Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0