Monday, March 2, 2020

INTRODUCTION for....PYTHON

Basic for PYTHON.....
-March 2.3.2020

CONCEPT:
Introduction for Python.....and basic method.
today class for..
#LIST  []
#SORTING
#TUPLES ()
#SET  {}


                              #LIST []

Example 1:

fruits=['apple', 'orange', 'cherry']
print(fruits)
output:
('apple', 'orange', 'cherry')

Example 2:

fruits=['apple','orange','cherry']
print(fruits[1])
output:
orange

Example 3:

fruits=['apple','orange','cherry']
print(fruits[1:3])
output:
orange, cherry

Example 4:
fruits=['apple','orange','cherry']
print(fruits[-1])
output:
cherry

Example 5:

fruits=['apple','orange','cherry']           
fruits[1]='banana'
print(fruits)
output:
['apple','banana','cherry']

Example 6:

 
fruits.append('banana')                       #Append used for  JOIN ONE STRING.
print(fruits)
output:
['apple','orange','cherry', 'banana']

                                                     #SORTING

number=[11, 2, 20, 0]
number.sort()
print(number)                                       #SORTING IS USED FOR ARRANGING THE  NUMBER 
 output:                                                     FROM ASCENDING  TO DESCENDING
[0, 2, 11, 20]

Example 2:

number=[11, 2, 20, 0]
number.sort(reverse=true)
print(number) 
output:
[ 20, 11, 2, 0]   

                                                   #TUPLES ()


fruits=['apple','orange','cherry']
number=[11, 2, 20, 0]
print(fruits+number)                     #A Tuples is a collection  which is order and  UNCHANGEABLE.
output:
['apple','orange','cherry', 11, 2, 20, 0]

                                                   #SET{}

fruits={'apple','orange','cherry'}
print(fruits)
number=(11, 2, 20, 0)                           #Set  is Use for Changing the order
print(number)
output:
{'apple','orange','cherry'}
(11, 2, 20, 0)


                                                







 




Sunday, March 1, 2020

PYTHON INTRODUCTION.........simple to learn.

Basic for PYTHON.....
-March 1.3.2020

CONCEPT:
Introduction  for Python.......and basic method.

PYTHON FACTS:
-This Developed  by GUIDO VAN ROSSUM and released on February 20,  IN 1991.

IMPORTANT  3 THINKS.

Indentation----> TO Avoid Unnecessary Space.
Colon        ----> This must for Python.
Function:

CONTENTS:-

Primitives--> Number, strings, Boolean . 

#INTEGERS --1, 2, 3, 4..........Numbers.
#FLOAT-- 1.2 , 5.6, 9.5,
#COMPLEX-- 5+2j


                                               #VARIABLES
Example 1:

  Watch=500
  print(Watch)

output:
     500

Example 2:
  Watch=500
   print(Watch+20)

output:

520
    
                                             #STRING METHOD.

Example 1:

word1="hi dude"
word2="my age is 24!"
print(word2)
out put:
my age is 24!

IN PYTHON STRING CONVERTED  IN ARRAY.

Array start in ZERO.


INDICES:

word1="HELLO"
print(word1[3])

output:
L

SLICING:

word3="HELLO"
print(word3[1:3])                       

output:
EL                                         #Before array value in 3.

LENGTH:
word3="hello,  world"
print(len(word3))            #keyword------len
output:
12

STRIP()

word2="    my age  is 19"
print(word2)                           #Strip is used in removed in unnecessary space.
output:                                     
Error                  #because  word2    using unnecessary   space.


word2="my age is 19"
print(word2)
output:
my age is 19

BOOLEAN:

Example 1:
   word3="hello"
   print("hell" in word3)                 #Boolean
                                                    #out put is --------> TRUE , FALSE
output:
TRUE

Example 2:
   word3="latha"
   print("hell"in word3)
output:
FALSE