Python:

Python is a programming language.
Python can be used on a server to create web applications. 

Features of python

  • It is interpreted based language.
  • python is a open source and light weighted language.
  • It's platform is independent.
  • It is object oriented programming language(OOPs).
  • It is case sensitive.

Python data types

In programming, data type is an important concept.
Variables can store data of different types, and different types can do different things.
Python has the following data types built-in by default, in these categories:

Text Type:str
Numeric Types:intfloatcomplex
Sequence Types:listtuplerange
Mapping Type:dict
Set Types:setfrozenset
Boolean Type:bool
Binary Types:bytesbytearraymemoryview

Setting the Data Type

In Python, the data type is set when you assign a value to a variable:

ExampleData Type
x = "Hello World"str
x = 20int
x = 20.5float
x = 1jcomplex
x = ["apple", "banana", "cherry"]list
x = ("apple", "banana", "cherry")tuple
x = range(6)range
x = {"name" : "John", "age" : 36}dict
x = {"apple", "banana", "cherry"}set
x = frozenset({"apple", "banana", "cherry"})frozenset
x = Truebool
x = b"Hello"bytes
x = bytearray(5)bytearray
x = memoryview(bytes(5))memoryview

Python character set -

Character set is a set of valid characters that a language can recognise, character can be applied Alphabet (a-z), (A-Z), Number (0-9) and special symbol like ,."(); etc python supports unicode.

Tokens

The smallest individual unit in a program is known as a token or lexical unit. The five types of tokens available in python: 

  • Keywords : int, if, elif, for, etc (Reserve word).
  • Identifier.
  • Literal or constant .
  • Separates or punctuators.  
Identifiers  or variables whose  values can changes.

The naming rule of identifiers.                                        

  1. The first character can be alphabets (A - Z) or underscore.
  2. On words character can be  alphabets (A - Z), No (0 - 9), or underscore.
  3. No , special character is allowed other than underscore.
  4. Keywords cannot be taken as identifiers.
  5. Space is not allowed.

  • Literals : Special literals  (none constant).

  • Punctuators or Separators : . # , : ; [ ] () {} etc.   

Literals constant

  • String literal                            
  • Boolean: True and false (condition wise).
  • Numeric: Integer (1,43,20) and Float (10.2,4.5)

An integer is colloquially defined as a number that can be written without a fractional component. For example, 21, 4, 0 etc

Floating it's a fundamental data type built into the compiler that's used to define numeric values with floating decimal points. for example 10.2, 1.1, 24.1 etc 

String literals are inclosed with in single code, double court, or triple code.

       here two types of line which are following-

  1. single line .
  2. Multiple line. 

single line                 'smash'                

                                     "smash"     

                                   "'smash"'     

Multiple line  line string can  be created by:

  • Adding a back slash at the end of each line and finally by using single code.
  • Typing the text in triple code.  

 "' python\  

   for\   

   beginners"'

Operators                                             

Arithmetic Operator 

  • Unary  Operators : eg -a, -10.
  • Binary Operators : +,  -, *,  /, //, %.

Logical Operator          (and  , or , not)

Relational Operator   > , < , >=, <=, ==

Assignment Operator  (=, +=, -==,*=  etc) Shorthand Operator.

 

Q. Write a program to take 3 variable to store the values , 20 , 35, and 70 into them. find the sum of all the 3 variables and then print.

               x=20
               y=35
               z=70
       sum= x+y+z
   print("sum=", sum)


Output:

sum= 125

                 
                                     Thanks to visit coding smash...