In this part we are going to understand the basics of Python. These basics can really help you while starting coding in Python. Python is a lot different from the other programming languages in terms of writing style and syntax.
How to print ?
To print something in Python you need to use the keyword "print( )".
- To print a simple string -
You can either use double quote [ " ] or single quote [ ' ] both will work same in Python.
- To print a variable -
- To print a string with a variable -
After understand how to print in Python, now lets understand how to initialize variables.
Variables
A variable is a name given to the memory address of your system whose value is not fixed and can be altered at the run-time.
To declare a variable in Python first you need to know the rules to name the variable.
Rules to name a variable -
- It must start with a letter or underscore( _ ).
- It shouldn't start with a digit.
- A variable name can only contains alpha-numeric characters and numbers (A-z, 0-9 and _ ).
- Variable names are case sensitive.
Also to initialize multiple variable at the same time we can do
where x, y, z is equal to 20, 10, 30 and a, b, c is equal to 'Hello', 'Coders', ' ! ' respectively.Indentation
Indentation is very important and have a crucial role in Python. Instead of using the parenthesis {} in Python, we use "Indentation". It's work is similar to the work of parenthesis i.e, to describe scope of the statements under which they lie. Basically an 'Indentation' is a [tab] space. Let's understand it by an example.
#Comments
1 Comments
Thank you sir very helpful for me love you
ReplyDelete