Page 79 - 2619_PlusGPT V2.1_C-8
P. 79

On the output screen, a = 20 and b = 40 will be printed. You can also assign the same value to
                 multiple variables at the time in the following way:

                   a = b = 20

                   print ("a=", a)

                   print ("b=", b)
                 On the output screen, a = 20 and b = 20 will be printed.

                 You can also assign multiple values to multiple variables in the same line in the following way:

                   name, age, grade="Deepak", 12, ‘VII’

                   print ("Name is", name)

                   print ("Age is", age)

                   print ("Grade is", grade)
                 On the output screen, Name is Deepak, Age is 12 and Grade is VII will be printed.

                 You must follow the given rules while creating and naming the variables:

                   A variable name must start with a letter or underscore character.

                   A variable name cannot start with a number.
                    A variable name can only contain alphanumeric characters (all the letters of the alphabet and

                   numbers) and underscores (_).

                   Variable names are case-sensitive.
                   Variable names cannot contain any special character or symbol.



                        DATA TYPES


                 Data types are used to define the type of value a data can contain. Each variable in Python is
                 associated with some data type. Each data type requires a different amount of memory and has some

                 specific operations performed on it.
                 Data types are divided into four categories as shown below:

                                                                    Data Types



                                   Numbers        Dictionary         Sets           Sequence          Boolean



                       Integer/long             Float                      String                 List

                                   Complex                                            Tuple





                                                                                             Introduction to Python  77
   74   75   76   77   78   79   80   81   82   83   84