## How to use while loop repetition control in python with examples

There are two types of repetition control instructions in python.
1. while loop
2. for loop
1.) while Loop:
• A while loop allows a part of code to be executed as long as the given condition is true.
• The while loop is used to repeatedly execute instructions as long as expression is true.
• A while loop is used in the case where the number of iterations is not know in advance.
3

## How to use if-else, elif decision control instruction in python with examples

There are two ways to control the program flow as given below:-
1. Decision control instruction (e.g. if ,if-else,elif)
2. Repetition control instruction (e.g. while,for)
Indentation in Python:-
• Indentation is used to declare a block in python.If two statements are at the same indentation level,then they are the part of the same block.
• Python doesn't allow the use of parentheses for the block of codes.
• All the statements of one block are intended at the same level indentation.
• In this,we will see how the actual indentation takes place in decision control instructions and others in python.
Decision control instruction:-
There are three ways for taking decisions in a program as given below.
1. if condition
2. if-else condition
3. elif condition
3

## What is Asymptotic Notations and how to design and analysis of algorithms with examples

There are many solutions for a particular problem.Means, For one problem we can design more than one algorithms.But how to find which algorithms are good and which are bad.

There are two ways to find the Ideal Algorithms for any particular problem as given  below:-
1. Time:-An algorithm is good which takes less time.
2. Space:-An algorithm is good which takes less space(storage).
The efficiency of any algorithms fully dependent on time,space and other resources which are needed to execute any algorithms.
Asymptotic Notations:-
Asymptotic notations are the mathematical notations.It is used to represent the complexity of algorithms.This allows us to analyze an algorithm's running time and its behaviors. There are mainly three asymptotic notations to find the complexity of algorithms as given below:-
3

## What is Algorithms and its Characteristics with examples

Algorithm:-
• An algorithm is a finite lists of instructions in sequence to solve the computation problems.
• An algorithm is a step by step of finite number of process to solve the problems.You can write the algorithms in any language which is understandable to the persons (programmers)
• In Real life,an algorithm is a recipe for any cooking dish.
Characteristics of Algorithms:-
There are following characteristics of any algorithms as given below.
3

## string concepts in python part 5

There are some operational functions for the strings as given below:-
1.) split() :-The split() function is used to split(breaks up) at a specified separator and returns a list of strings.
Syntax
string.split(separator,maxsplit)
The split function takes maximum two parameters as given below:-
• Separator:-This is an optional parameter.If separator is specified ,the string split at this specified separator.If separator is not specified ,the string is split at white space (space,newline,coma etc.) separator.
• maxsplit:-This is also an optional parameter.The maxsplit is used to define maximum number of splits. The default value of max split is -1 ,means no limit of number of splits.
3

## String concepts in python Part 4

There are some search and replace functions operations in strings as given below:-
1.) find():- The find() function returns the index value of the string where the substring is found between start index and end index.start index and end index is optional parameter.

• If substring is present in given string then this function returns the index of the first occurrence of the substring.
• If the substring is not exist inside the string then it returns -1 index
3

## string concepts in python part 3

String operations in python:
There are many Built-in string function available in python language.Here We will learn content test functions with examples as given below:-
1.) isalpha() :-It returns True ,if all characters in the string are alphabets otherwise False. The alphabets can be lower case and upper case both.This function doesn't take any parameters.If string contains a white space or any numeric value then this function returns False.
Syntax:-
String.isalpha()
3

## Strings Concepts in Python Part 2

String operators in Python:-There are some operators used to perform some basic operations on strings.
• + (plus) operator) :-it is known as concatenation operator.it is used to concatenate two or more strings in python language.
e.g.
``````str1="Welcome to"
str2="MNT LAB"
str3="msdotnet"
str=str1+str2
print("Concatenate the two string: ",str)
print("Concatenate the two string: ",str1+' '+str3)
``````
Output of Above Python program
Concatenate the two string:  Welcome toMNT LAB
Concatenate the two string:  Welcome to msdotnet
3

## Strings concepts in python part 1

What is Python strings?
• Python string is a collection of Unicode characters.
• String is a popular data type of python language.
• Python allow us to create the string by using single quotes,double quotes or triple quotes.
• Strings can be created by enclosing the the character or the sequence of characters in the quotes(single,double or triple ) in python language.
We can create a string in python in following way as given below:-
3

## Operators in Python with examples

Operators are special symbols in python which are responsible for a particular operation between two or more operands.Operators are more helpful for doing operations between two operands.We will learn everything about different type of operators in python with examples.
e.g.
``````a=5;b=6;
c=a+b
print("value of a+b= ",c)```
```
Output of above program:-
value of a+b= 11
Descriptions:- In above program
operators --> =,+
operands --> a,b,c
There are many variety of operators present in python as follows:-
1. Arithmetic operators
2. Comparison operators
3. Assignment operators
4. Logical operators
5. Bitwise operators
6. Membership operators
7. Identity operators
3

## Print() function in python Language with examples

The print() function is used for sending the output to the screen.It is used to display the output of any variables like string,list,tuple,set,dictionary,etc.Print() function is a built-in function in python language.
Syntax:-
print(*objects,sep=' ',end='\n',file=sys.stdout,flush=False)

Descriptions:-

1.) objects:-The object can be Integer,Float,string,list,tuple,set,etc.
e.g.
``````
a=234
b='ram'
list=[1,2,3,4,5,6]
tuple=(1,2,3,4,5,6)
dictionary={'a':'apple','b':'bag','c':'cat','d':'dog'}
set={'a','e','i','o','u'}
print("value of a=",a)
print("value of b=",b)
print("value of list=",list)
print("value of tuple=",tuple)
print("value of dictionary=",dictionary)
print("value of set=",set)
print("value of 12*45=",12*45)
``````
output of the above python program:-
value of a= 234
value of b= ram
value of list= [1, 2, 3, 4, 5, 6]
value of tuple= (1, 2, 3, 4, 5, 6)
value of dictionary= {'a': 'apple', 'b': 'bag', 'c': 'cat', 'd': 'dog'}
value of set= {'o', 'e', 'i', 'a', 'u'}
value of 12*45= 540

2.) sep=' ' :-This parameter is used to give space between multiple objects.You an use this parameter other than space also.It will be shown in below programs.
e.g.
``````a=5
b=6
c=24
d=60
e='ram'
f='sita'
print("value of a,b,c,d=",a,b,c,d)
print("value of a,b,c,d=",a,b,c,d,sep='  ')
print("value of a,b,c,d=",a,b,c,d,sep=',')
print("value of a,b,c,d=",a,b,c,d,sep='\n')
print("value of e,f =",e+' '+f)
``````
output of the above python program:-
value of a,b,c,d= 5 6 24 60
value of a,b,c,d=  5  6  24  60
value of a,b,c,d=,5,6,24,60
value of a,b,c,d=
5
6
24
60
value of e,f = ram sita
3.) end=' \n' :-It means,when we call print () function each time.it will end at a new line.In python by default ,print() function always ends at a new line.You can change it. i will see in the programs.
3

## Literals Concepts in Python Language

Literal is defined as a raw data that is given in a variable or constant.
There are various types of Literals in python as given below:-
1. Numeric Literals
2. String Literals
3. Boolean Literals
4. Special Literals
5. Collections Literals
1.) Numeric Literals:- Numeric Literals are immutable(unchangeable).There are three different numerical types integer, Float and complex present in Numeric Literals.
e.g.
Integer Literals:-
``````a=0b1111   #binary Literal
b=400      #decimal Literal
c=0o62     #octal Literal
print("value of a=",a)
print("value of b=",b)
print("value of c=",c)
print("value of d=",d)``````
Output of above Python codes:-
value of a= 15
value of b= 400
value of c= 50
value of d= 102
Note:-
• In above program .I have assigned different literals(binary,decimal,octal and hexadecimal) in different variables(a,b,c,d).
• When we run the program,all literal values convert into decimal values.
e.g.
Float Literals:-Real numbers with integer and fractional part.
``````float_a=20.12
float_b=26e2
float_c=12.43
print("value of float_a=",float_a)
print("value of float_b=",float_b)
print("value of float_c=",float_c)
``````
Output of above Python codes:-
value of float_a= 20.12
value of float_b= 2600.0
value of float_c= 12.43
e.g
Complex Number:
``````c=3+12.25j
print('complex number c=',c)
print('complex number real value=',c.real)
print('complex number imaginary value=',c.imag)
``````
Output of above Python codes:-
complex number c= (3+12.25j)
complex number real value= 3.0
complex number imaginary value= 12.25
2.) String Literals :- A string Literal can be generated by enclosing the text in the quotes.we can use both quotes(single,double as well as triple) for a string.
e.g.
``````a='i am a student'               # string literals
b="hello friends !"
c='''How are you'''
d='c'                             #character literal
e="""welcome                      #multi line string
To
My website:
https://www.msdotnet.co.in """
f= r"raw''\nvalues"            #raw string
g=u"\u00dcnic\u00f6de"         #unicode string
print('value of a=',a)
print('value of b=',b)
print('value of c=',c)
print('value of d=',d)
print('value of e=',e)
print('value of f=',f)
print('value of g=',g)
``````
Output of above Python codes:-
value of a= i am a student
value of b= hello friends !
value of c= How are you
value of d= c
value of e= welcome                      #multi line string
To
My website
https://www.msdotnet.co.in
value of f= raw''\nvalues
value of g= Ünicöde

3.) Boolean Literals:-A Boolean literals have only two values:true or false.
``````a=(True==1)
b=(False==0)
c=(True+10)
d=(False+20)
e=(False==1)
print('value of a=',a)
print('value of b=',b)
print('value of c=',c)
print('value of d=',d)
print('value of e=',e)
``````
Output of above Python codes:-
value of a= True
value of b= True
value of c= 11
value of d= 20
value of e= False
4.) Special Literals :- Python contains one special literal i.e. None. we use this literal(None) that field is not created.
``````value_1=400
value_2=200
value_3=None
print('value_1=',value_1)
print('value_2=',value_2)
print('value_3=',value_3)
``````
Output of above Python codes:-
value_1= 400
value_2= 200
value_3= None

5.) Collection Literals:-There are four different types of collection literal :
• List
• Tuple
• Sets
• Dictionary
List,Tuple,set,dictionary literals:-List contains items of different data types.list are mutable(changeable).
e.g.
0     1        2        3     4      5
``````list_1=['ram','sita',200,35.45,105,0b101]      # list contains different types of values
#we can retrieve list value using slice operator([] and [:])
list_2=list_1[0:3]
list_3=list_1[2:5]
list_4=[]
# + sign is used to concatenation(add) two list and * sign is used for repetition .
list_a=['ram','20','12.32']
list_b=['sita','mohan',500]
list_c=(list_a)+(list_b)
list_d=(list_a)*2
list_e=(list_b)*2
tuple=(1,2,3,4,5,6)
dictionary={'a':'apple','b':'bag','c':'cat','d':'dog'}
set={'a','e','i','o','u'}
print(list_1)
print(list_2)
print(list_3)
print(list_4)
print(list_c)
print(list_d)
print(list_d)
print(tuple)
print(dictionary)
print(set)``````
Output of above Python codes:-
['ram', 'sita', 200, 35.45, 105, 5]
['ram', 'sita', 200]
[200, 35.45, 105]
[]
['ram', '20', '12.32', 'sita', 'mohan', 500]
['ram', '20', '12.32', 'ram', '20', '12.32']
['ram', '20', '12.32', 'ram', '20', '12.32']
(1, 2, 3, 4, 5, 6)
{'a': 'apple', 'b': 'bag', 'c': 'cat', 'd': 'dog'}
{'u', 'a', 'e', 'o', 'i'}

Special Notes:-
Input () built-in function:- This function(or method) reads a line from console input,converts into a string and return it. This function is more important in python to read a input line from console(prompt).
e.g.
``````a=int(input("Enter the First value:"))
b=int(input("Enter the second value:"))
sum=a+b
multi=a*b
print("your sum of a and b =",sum)
print("your multi of a and b =",multi)

print("my name is= ",c)
d=input()
print("my friend's name="+d)``````
Output of above Python codes:-

Enter the First value:10
Enter the second value:20
your sum of a and b = 30
your multi of a and b = 200
my name is=  RAM
MOHAN
my friend's name=MOHAN
Watch Complete Lecture Video:-
3

## Basic fundamentals of python part 4

There are many built-in functions available in Python Language. We can use this functions in any program and make your program easy.Here we will learn some important mathematical functions and use it in python programs.
Built-in Mathematical functions:-
• pow(x,y)               #value of x raised to y
• abs(x)                  #absolute value of x
• min(x1,x2)           #smallest value
• max(x1,x2)          #largest value
• divmod(x,y)         #return a pair(x//y,x%y)
• bin(x)                  # binary value
• oct(x)                  # octal value
• round(x[,n])         # x rounded to n digit after decimal point
• sum(number,start) #sum function contains two arguments,start is optional argument.
• any(x)                     # it returns True or false value,x can be list,string , dictionary etc.
• all(x)                       # it returns True or false value .x can be list , string , dictionary etc.
• ascii(object)           # it return a string,it takes arguments like integer string,list,etc
• bool(value)             # bool() function takes a single parameter,it return True OR False
• complex(a,b)           #It returns a complex number.it takes integer value only.
Python Program to implement above functions:-
``````
pow(2,3)           # 8 will be(x^y) returned
print("power value is=",pow(2,3))
pow(-2,2)          # 4 will be(x^y) returned
print("power value is=",pow(-2,2))
pow(-1,-2)         # 1.0 will be(x^y) returned
print("power value is=",pow(-1,-2))
pow(2.5,2)         # 6.25 will be(x^y) returned
print("power value is=",pow(2.5,2))
pow(5,3,4)         # 1 will be [(x**y)%z] returned
print("power value is=",pow(5,3,4))

abs(-20)           #integer absolute value is returned
print("absolute value is=",abs(-20))
abs(-10.55)        #float absolute value is returned
print("absolute value is=",abs(-10.55))
abs(2-3j)          #magnitude of the number is returned
print("absolute value is=",abs(2-3j))

min(5,-8)          # minimum value -8 is returned
print("minimum value is=",min(5,-8))
list1=[2,3,-2,5,9] # minimum value -2 is returned
min(list1)
print("minimum value is=",min(list1))
list2=['ram','mohan','abc'] #least ordered alphabet is returned
min(list2)
print("minimum value is=",min(list2))
dic={1:3,2:4,3:-1}  #minimum key value will print of dictionary
min(dic)
print("minimum value is=",min(dic))

max(-8,7)          # maximum value 7 is returned
print("maximum value is=",max(-8,7))
list1=[2,3,-2,5,9] # maximum value 9 is returned
max(list1)
print("maximum value is=",max(list1))
list2=['ram','mohan','abc'] #maximum ordered alphabet is returned
max(list2)
print("maximum value is=",max(list2))
dic={1:3,2:4,3:-1}  #maximum key value will print of dictionary
max(dic)
print("maximum value is=",max(dic))

divmod(5,2)        #5//2 and 5%2 will be returned
print("divmod value is=",divmod(5,2))
divmod(5.7,2.5)        #5//2 and 5%2 will be returned
print("divmod value is=",divmod(5.7,2.5))

bin(5)             # bin()fuction can contains three arguments(integer,octal,hexadecimal)
bin(0o5)
bin(0x5)
print("binary value is=",bin(5),bin(0o5),bin(0x5))

oct(5)            # oct()fuction can contains three arguments(integer,binary,hexadecimal)
oct(0b101)
oct(0x5)
print("octal value is=",oct(5),oct(0b101),oct(0x5))

hex(5)            # hex()fuction can contains three arguments(integer,octal,binary)
hex(0b101)
hex(0o5)

round(10)         # it rounds 0 decimal palace,default value of round is 0(zero)
print("round value is=",round(10))
round(10.5)
print("round value is=",round(10.5))
round(10.5678,2)
print("round value is=",round(10.5678,2))
round(10.78432,3)
print("round value is=",round(10.78432,3))

#sum(number,start)   #sum function contains two arguments,start is optional argument.
number=[1,2,3,4,-1]
sum(number)
print("sum value is=",sum(number))
sum(number,10)      #add the value from left to right
print("sum value is=",sum(number,10))

#any(x)              # it returns True or false value .x can be list,string,dictionary etc.
x=[1,2,3,4]
any(x)
print("any value is=",any(x))
x=[0,False]
any(x)
print("any value is=",any(x))
x=[0,False,3,4]
any(x)
print("any value is=",any(x))
x=''
any(x)
print("any value is=",any(x))

#all(x)              # it returns True or false value .x can be list,string,dictionary etc.
x=[1,2,3,4]
all(x)
print("all value is=",all(x))
x=[0,False]
all(x)
print("all value is=",all(x))
x=[0,False,3,4]
all(x)
print("all value is=",all(x))
x=''
all(x)
print("all value is=",all(x))

#ascii(object)           # it return a string,it takes arguments like integer string,list,etc.
str='i am a student'
ascii(str)
print("ascii value is=",ascii(str))
str1="i am 'a' student"
ascii(str)
print("ascii value is=",ascii(str))
ascii(12)
print("ascii value is=",ascii(str))

#bool(value)        # bool() function takes a single parameter,it return True OR False
str=[1,2,3]
bool(str)
print("bool value is=",bool(str))
str=[]
bool(str)
print("bool value is=",bool(str))
str='0'
bool(str)
print("bool value is=",bool(str))
str=''
bool(str)
print("bool value is=",bool(str))

#complex number

real=2
imag=3
print('complex number =',complex(real,imag))
print('complex number =',complex(1.5,3.5))
print('complex number =',complex('2'))
#print('complex number =',complex('2','3'))  #can't take second argument if first is string
c=4+5j
print('complex number Real part =',c.real)
print('complex number Real part =',c.imag)
print('complex number conjugate =',c.conjugate())
#mathematical operations in complex number
c1=4+6j
c2=1+2j
print('subtractions of two complex number=',c1-c2)
print('multiplication of two complex number=',c1*c2)
print('division of two complex number=',c1/c2)
``````

Python Program Output:-

power value is= 8
power value is= 4
power value is= 1.0
power value is= 6.25
power value is= 1
absolute value is= 20
absolute value is= 10.55
absolute value is= 3.605551275463989
minimum value is= -8
minimum value is= -2
minimum value is= abc
minimum value is= 1
maximum value is= 7
maximum value is= 9
maximum value is= ram
maximum value is= 3
divmod value is= (2, 1)
divmod value is= (2.0, 0.7000000000000002)
binary value is= 0b101 0b101 0b101
octal value is= 0o5 0o5 0o5
hexadecimal value is= 0x5 0x5 0x5
round value is= 10
round value is= 10
round value is= 10.57
round value is= 10.784
sum value is= 9
sum value is= 19
any value is= True
any value is= False
any value is= True
any value is= False
all value is= True
all value is= False
all value is= False
all value is= True
ascii value is= 'i am a student'
ascii value is= 'i am a student'
ascii value is= 'i am a student'
bool value is= True
bool value is= False
bool value is= True
bool value is= False
complex number = (2+3j)
complex number = (1.5+3.5j)
complex number = (2+0j)
complex number Real part = 4.0
complex number Real part = 5.0
complex number conjugate = (4-5j)
addition of two complex number= (5+8j)
subtractions of two complex number= (3+4j)
multiplication of two complex number= (-8+14j)
division of two complex number= (3.2-0.4j)

Note:-Complex number doesn't support comparison operators(c1>c2,c1<c2 etc.)
Watch Lecture 7 Complete Video:-

Library Functions:-
For performing sophisticated mathematical operations,we can use the functions present in modules:-
• Math:- It is used for useful mathematics functions.
• cmath:- It is used for performing operations on complex numbers.
• decimal:- It is used for performing arithmetic operations.
• random :- It is used for performing number random number generations.
There are some mathematical functions in math module as follows:-
• pi,e                          # It is constants
• sqrt(x)                     #calculate square root of x
• fabs(x)                    # calculate absolute vale of float x
• factorial(x)              # calculate factorial of x
• log(x)                     # calculate log of x
• log10(x)                 # calculate base 10 log of x
• exp(x)                   # calculate e raised to x
• turn(x)                  # truncates to integer
• ceil(x)                   # calculate smallest integer >= x
• floor(x)                 # calculate largest integer <= x
• modf(x)                # calculate fractional and integer part of x
• round(x)               # Round to a specific number of decimal places.
Note:- round() function is used to round to a specific number of decimal places,whereas trunc() , ceil()  and floor() functions always round to zero decimal places.

There are some Trigonometric functions in math module as follows:-
• degrees(x)            # calculate radians to degree
• sin(x)                 # calculate sine of x radians
• cos(x)                # calculate cosine of x radians
• tan(x)                # calculate tan of x radians
• sinh(x)               # calculate hyperbolic sine of x
• cosh(x)              # calculate hyperbolic cosine of x
• tanh(x)              # calculate hyperbolic tan of x
• asin(x)               # calculate sine inverse of x, in radians
• acos(x)               # calculate cos inverse of x, in radians
• atan(x)               # calculate tan inverse of x, in radians
• hypot(x,y)           # calculate  sqrt(x*x+y*y)
``````
import math

print("Value of pi =",math.pi)
print("Value of pi =",math.pi)

print("Value of square root =",math.sqrt(25))

print("Value of fabs =",math.fabs(12.3450))

print("Value of factorial =",math.factorial(4))

print("Value of log(x) =",math.log(5))
print("Value of log10(x) =",math.log10(5))

print("Value of exp(x) =",math.exp(2))

a=2.65
b=-3.15

print("Value of trunc =",math.trunc(a))
print("Value of trunc =",math.trunc(b))

print("Value of ceil =",math.ceil(a))
print("Value of ceil =",math.ceil(b))

print("Value of floor =",math.floor(a))
print("Value of trunc =",math.floor(b))

print("Value of round =",round(a))
print("Value of round =",round(b))

print("Value of pi radian in degrees =",math.degrees(math.pi))

print("Value of sin =",math.sin(10))
print("Value of cos =",math.cos(10))
print("Value of tan =",math.tan(10))
print("Value of sinh =",math.sinh(5))
print("Value of cosh =",math.cosh(5))
print("Value of tanh =",math.tanh(10))
print("Value of asin =",math.asin(1))
print("Value of acos =",math.acos(1))
print("Value of atan =",math.atan(1))
print("Value of hypot =",math.hypot(0,5))
``````
Above program output:-
Value of pi = 3.141592653589793
Value of pi = 3.141592653589793
Value of square root = 5.0
Value of fabs = 12.345
Value of factorial = 24
Value of log(x) = 1.6094379124341003
Value of log10(x) = 0.6989700043360189
Value of exp(x) = 7.38905609893065
Value of trunc = 2
Value of trunc = -3
Value of ceil = 3
Value of ceil = -3
Value of floor = 2
Value of trunc = -4
Value of round = 3
Value of round = -3
Value of pi radian in degrees = 180.0
Value of degrees in radians = 3.141592653589793
Value of sin = -0.5440211108893698
Value of cos = -0.8390715290764524
Value of tan = 0.6483608274590866
Value of sinh = 74.20321057778875
Value of cosh = 74.20994852478785
Value of tanh = 0.9999999958776927
Value of asin = 1.5707963267948966
Value of acos = 0.0
Value of atan = 0.7853981633974483
Value of hypot = 5.0

decimal module:- It is used for mathematical operations in python
``````
import decimal
print('decimal value is=',0.2)
a=1.1
b=2.4
c=a+b
print('decimal value is=',c)
``````
Above python code Output:-
decimal value is= 0.2
decimal value is= 3.5

cmath module:-Python cmath module provides access to mathematical functions for complex numbers.
``````
import cmath
c=2+3j
modulus=abs(c)
phase=cmath.phase(c)
polar=cmath.polar(c)
print('complex number modulus is=',modulus)
print('complex number phase is=',phase) #angle between vector line and real axis
print('complex number polar coordinates is=',polar) #the straight line joining the two points at which tangents from a fixed point touch a conic section
print('rectangle co-ordinate value is=',cmath.rect(modulus,phase))
print('value of pi is =',cmath.pi)
print('value of e is =',cmath.e)
print('value of exonant is =',cmath.exp(c))
print('value of log2c is =',cmath.log(c,2))
print('value of log10c is =',cmath.log10(c))
print('value of sqrt is =',cmath.sqrt(c))
print('value of sine is =',cmath.sin(c))
print('value of inverse sine is =',cmath.asin(c))
print('value of sine hyperbolic is =',cmath.sinh(c))
print('value of inverse sine hyperbolic is =',cmath.asinh(c))``````
Above python code Output:-
complex number modulus is= 3.605551275463989
complex number phase is= 0.982793723247329
complex number polar coordinates is= (3.605551275463989, 0.982793723247329)
rectangle co-ordinate value is= (2+2.9999999999999996j)
value of pi is = 3.141592653589793
value of e is = 2.718281828459045
value of exonant is = (-7.315110094901103+1.0427436562359045j)
value of log2c is = (1.850219859070546+1.417871630745722j)
value of log10c is = (0.5569716761534184+0.42682189085546657j)
value of sqrt is = (1.6741492280355401+0.8959774761298381j)
value of sine is = (9.15449914691143-4.168906959966565j)
value of inverse sine is = (0.5706527843210994+1.9833870299165355j)
value of sine hyperbolic is = (-3.5905645899857794+0.5309210862485197j)
value of inverse sine hyperbolic is = (1.9686379257930964+0.9646585044076028j)

Random number generation functions in random module:-
• random()                    #generate random number between 0.0 & 1.0.
• randint(start,stop)     #generate random number in given range.
• seed (x)                     #map seed value used in random number generation logic.
• randrange(start,stop,step)                 #it returns a randomly selected element from the given range created by the start,stop and step and step argument
• choice()               #It returns element randomly from the given list.if list is empty then it so index error.
• shuffle()              #this function is used to randomly records the elements in the list.
• print()                        # it can be used for sending  output to screen.
``````
import random
print("Value of round =",random.random())
random.seed(20)

print(random.random())
random.seed(10)
print(random.random())

print("Value of round_integer =",random.randint(1,100))
print("Value of round_integer =",random.randint(30,95))

print("Value of round_range =",random.randrange(1,10,2))
print("Value of round_range =",random.randrange(1,10,3))

print("Value of round_choice =",random.choice('Ramashanker'))
print("Value of round_choice =",random.choice([10,14,50,70,23,26,80,93]))
number=[10,50,40,20,28,47]
print("Value of round_shuffle =",random.shuffle(number))
print("Value of round_shuffle_recorded =",number)
``````
Above python program output:-
Value of round = 0.10603902641997465
0.9056396761745207
0.5714025946899135
Value of round_integer = 55
Value of round_integer = 91
Value of round_range = 9
Value of round_range = 1
Value of round_choice = a
Value of round_choice = 93
Value of round_shuffle = None
Value of round_shuffle_recorded = [28, 47, 10, 50, 40, 20]
Note:- we have to import that respective modules first in your program,to use respective functions present in that modules.

Watch complete Video:-

3

## Basic fundamentals of python part 3

Some Operations and type Conversions:-
This concepts is more helpful for beginners and professionals.You can learn python basic concepts from here with examples.This concepts are more helpful to learn advance python programming also.
There are some operations and type conversions in python programs as given below:-
• Arithmetic operators :-
+, -, *, /, %, //, **
+ --> Addition of two numbers(digits).
e.g.
a=9
b=5
c=a+b
print(c)
Output:-
14

- --> Subtractions of two numbers.
e.g.

a=10
b=5
c=a-b
print(c)
Output:-
5

--> Multiplication of numbers.
e.g.

a=10
b=5
c=4
d=a*b*c
print(d)
Output:-
200
/ --> Division of Two numbers.
a=100
b=5
c=a/b
print(c)
Output:-
20.0

%  --> It returns remainder
e.g.

a=10
b=3
c=a%b
print(c)
Output:-
1

**  --> Exponential operator

e.g.
base=3
exponent=4
result=base**exponent
print("Exponential value is:",result)
Output:-
Exponential value is: 81
OR
Use pow( ) function:-To calculate exponent value on any base ,python uses pow() function.
base=3
exponent=4
result=pow(base,exponent)
print(result)
Output:-
Exponential value is: 81
Note:- To calculate exponent value on base e,python uses exp( ) function.
e--> mathematical constant
e=2.71828 (approx)
First import math module for use exp( )  function in python programs.
Syntax:-
math.exp(exponent)
program:
import math
exponent=4
result=math.exp(exponent)
print (result)

Output:-
54.598150033144236

// -->it returns quotient after discarding fractional part(decimal point).
e.g.
a=50
b=3
c=50//3
print(c)
Output:-
16

• Compound  assignments operators :-
There are following compound assignments operators used in python programs as shown below:-
+= , -= ,/= , %= , **= , //=
a+=5 : #same as  a=a+5
a-=5 : #same as  a=a-5
a*=5 : #same as  a=a*5
a/=5 : #same as  a=a/5
a**=5 : #same as  a=a^5
a//=5 : #same as  a=a//5

• Type conversions:- In Python Programs ,we can convert one numeric type to another using built-in function int(),float(),complex(),char(),str() and bool().
1. )   int(float/numeric string)  # from float to int & float to numeric string
e.g.
int(3.5)                             #output: 3
int('786')                           #output: 786

2.)  int (numeric string, base)        # from numeric string to int in base
e.g.
int ('123',10)            #output: 123

3.) Complex(int / float) # convert to complex  with imaginary part 0
e.g.
complex(25)                  #output: 25+0j
complex(25.70)               #output: 25.70+0j

4.) complex(int\float , int/float       # convert to complex
e.g.
complex(5,7)                     #output 5+7j
complex(5.3,7.5)            #output 5.3+7.5j
complex(5.3,7)                #output 5.3+7j
complex(5,7.5)               #output 5+7.5j

5.) bool(int / float)              # from int/float to True/False (1/0)
e.g.
bool(24)                                  #output True
bool(12.60)                            #output True
bool(1)                                    #output True
bool(0)                                   #output False
bool()                                      #output False
bool(True)                             #output True
bool(False)                            #output False
bool(None)                            #output False

6.) str(int/float/bool)         # convert to string
e.g.
str(50)                                         #output '50'
str(6.4)                                        #output '6.4'
str(True)                                     #output 'True'
str(Flase)                                    #output 'False'

6.) chr(int)                  # convert to Unicode character
e.g.
chr(0)                                        #output '\x00'
chr(5)                                        #output '\x05'
chr(65)                                      #output 'A''
chr(67)                                      #output 'C'
chr(95)                                      #output '-'
chr(125)                                      #output '}'

#Watch Complete Video:-

3

## Basic fundamentals of Python part 2

Python keywords :-
• Python has 33 keywords that are given below.
• All keyword in lowercase except(False,None&True)

Note ->
• keyword is not used as identifier name in the application.
3

## Basic fundamentals of Python part 1

There are following basic fundamentals of python as given below.
1. Tokens
3. Python types
4. Operations and conversions
5. Built-in functions
6. Library functions
1.) Tokens :-
• Token can be defined as a reserved word, punctuation mark and each individual word in a statement .
• Token is the small unit in the given program.
3

## Python Programming Modes

There are two modes of python programs.
1. Interactive Modes
2. Script Modes
1.) Interactive Mode :-
• It is used for exploring Python syntax,seek help and debug short programs.
• Interactive modes uses IDLE (Python Integrated development and Learning Environment).
• It is available in windows after installation of python setup. Go Start Button--> Search IDLE --> open IDLE python--> It will be opened python shell prompt window-->You can run your python codes from here.
3