Table of contents
- Print command:
- Variable, constant & Data types:
- Variable, constant & printing of variable:
- Script for Calculator:
- Input from the user:
- Type Casting: (str to float)
- Different Calculator operator:
- Type Casting: (str to int) & Calculator:
- if statement:
- if-else statement:
- Data Structure & Algorithms:
- Diff b/w Array & List:
- Printing of List:
- Range:
- for loop for printing range:
- Printing the whole list by using for loop:
- Dictionary:
- Dictionary Updation:
- Import a library:
- Print disk usage:
- F string: formatting of the string
- Thank you for reading!Happy Learning!!
Why learn Python?
Huge community support.
Easy to understand & implement.
Library for approx everything.
Used for automation & scripting.
Python status & console:
Create a directory master-class-for-python under which all the python file will be kept.
Print command:
Variable, constant & Data types:
There are 4 data types:
str - string
int -integer
float - floating
bool - boolean(True/ False)
Variable, constant & printing of variable:
Script for Calculator:
Addition of 2 nos.:
Input from the user:
Input from the user is str type which needs to be converted in float or int type, this conversion of data type is: type casting.
Type Casting: (str to float)
Different Calculator operator:
Type Casting: (str to int) & Calculator:
if statement:
if-else statement:
Data Structure & Algorithms:
List
Set
Tuple
Dictionary
Multiple values can be added to list.
append is used to add the data in list.
Different types of data can be put on the list.
Diff b/w Array & List:
Array: a collection of similar type data.
List: a collection of different types of data.
Printing of List:
Range:
i[4]=(0,1,2,3)
always start from 0.
for loop for printing range:
Printing the whole list by using for loop:
Dictionary:
Key-value pair.
for getting & adding.
Dictionary Updation:
Import a library:
import - keyword.
os - is a library.
getcwd - current working directory.
shutil - module offers a number of high-level operations on files and collections of files.
Print disk usage:
F string: formatting of the string
Thank you for reading!Happy Learning!!
Santosh Chauhan