Course Content
What is Python?
Introduction of Python and Its setup
0/2
Control Statement
Control statements are used to control the flow of execution depending upon the specified condition/logic.
0/4
File Handling
File handling is an important component of any application. Python has multiple functions for creating, reading, updating, and deleting files.
0/2
Examples
Following are the examples of python scripts to try hands-on, you are ready to start your python journey.
0/7
Python
About Lesson

A variable in python is a container that stores data values. Python is a type-infer language i.e. it detects the data type of a variable automatically in other words you don’t need to specify the data type of variable.

Note: Python supports unlimited variable length, we keep the maximum length to 79 characters.

Example:

name = 'python' # String Data Type
sum = None # a variable without a value
x = 23 # integer
y = 6.2 # Float
sum = x+y
print(sum)

Multiple Assignments:

a = b = c = 1 #single value to multiple variables
a,b = 1, 2 #multiple value to multiple variable
a,b = b,a #value of a and b is swapped

Variable Scope and Lifetime:

  1. Local Variable
    def func():
       x=8
    print(x)
     
    func()
    print(x) #error will be shown
  2. Global Variable
    x = 8
    def fun():
       print(x) #Calling variable 'x' inside func()
     
    func()
    print(x) #Calling variable 'x' outside func()