DATA ANALYSIS
first to print the next line in python directlu use "\n"
\ is used to escape the current letter
to get single comment line use #
to get multiple comment linr use """text inside this"""
CREATING A VARIABLE
we can create variable by using any names and underscore but we cannot define using
numbers and symbols and it is case sensitive.
we cannot use space in between variables insted we can use under score
DATA TYPES
INT-to store interger values
FLOAT-to store float values
STRING-to store words which is enclosed in double or single quOTES
TYPE CASTING
-IMPLICT TYPE CONVERSION=where compiler convert the datatype by itself.
example=float value and int value sum is equals to float value
-EXPLICT TYPE CONVERSION=where the user should covert the data type.
example:we will take another variable and declare the existing variable into
another
a=10
b=float(a)
SWAPPING
in python we can perform swapping in two methods they are
->using the temporary variable
->using the right and left method
OPERATORS AND OPERANDS
arithmetic operators
assignment operators
comparison operators
bitwise operators
identity operators
membership operators
logical operators
ARITHMETIC OPERATORS
used to perform arithmetic operations.They are:
+,\,*,%
for powers use exponiation(**)
modulus used to find remainder of division(%)
floor division is used to find quotient(//)
COMPARISON OPERATORS
used to compare two or more values
<(lesser then)
>(greater then)
<=(less then or equal to)
>=(greater then or equal to)
==(is equals to)
!=(is not equals to)
LOGICAL OPERATORS
uses and, or, not
and returns true if the two conditons are correct
or returns true if one of the condition is true
not returns the reverse value of the two conditions
ASSIGNMENT OPERATORS
they are used to assign values to variable
x=9
score+=1(score anedhe plus 1 chestundi)
score-=1( score anedhe minus 1 chestundi)
score*=2(score anedhe multiply 1 chestundi)
IDENTITY OPERATORS
it is used to compare items to see if the are belongs to same data type with same
value
1.IS
2.IS NOT
BITWISE OPERATORS
it is used to compare the binary numbers
TYPES:
AND(&)OPERATOR
if 1,0=0
0,0=0
0,1=0
1,1=1
OR(|)OPERATOR
1,0=1
0,0=0
0,1=1
1,1=1
XOR(^)OPERATOR
1,0=1
0,0=0
0,1=1
1,1=0
<< ZERO FILL LEFT SHEET
cuts the value from left and add zeros to front
>> ZERO FILL RIGHT SHIFT
add zeros to left
NOTE:(use BIN function to find the binary numbers)
MEMBERSHIP OPERATORS
THESE operators are used to check the presence of sequence in an object(manam
declare chesna vaiable lo value vunda leda)
types:
1.IN
2.NOT IN
CONDITIONAL STATEMENTS
it allows the computer to execute the code if certain condition is true.
TYPES:
1.IF STATEMENT
if statement returns the true value if the given condition is true.
2.IF-ELSE STATEMENT
if else stament gives true if the given value is correct or false if the given
value is false.
3.IF-ELIF-ELSE STATEMENT
IN THIS case, the if condition is evaluated first.If it is false,the elif condition
is executed,if it als comes false then else stament is executed.
4.NESTED STATEMENT:
writing the statement inside the another statement.
5.SHORT HAND IF STATEMENT:
if statement and its body is written in the single line.