Page 108 - TP_Pluse_V2.2_Class_6
P. 108

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, 'VI'
                    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 VI 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.

                          Let’s CatCh uP

                    Circle the incorrect variable  in the following code:

                    Roll no = 201     Student Name = "Chirag"      Section = 'A'




                         DATA TYPES


                  A data type specifies the type of value a variable can contain. For example, a person’s name must
                  be stored as a string value, whereas the person’s age must be stored as an integer.

                  Data types in Python are:
                      int:  Positive or negative whole numbers (without any fractions). Example: a = 3, b= -5

                      float: Any positive or negative real number in which a fraction is denoted by a decimal number.
                    Example: a = 3.5

                      string: A string value is a collection of one or more characters enclosed in single or double quotes.
                    Example: a="hello"


                         COMMENTS IN PYTHON


                  Comments in Python can be used to explain parts of the code. It can also be used to hide the code as
                  well. Comments enable us to understand the way a program works. In Python, any statement starting
                  with # symbol is known as a comment. Python does not execute comments. Comments are not a part
                  of the program, but they do enhance the interactivity of the program and make it readable. Python
                  supports two types of comments: Single line comment and Multiline comment.

                  106   Plus (Ver. 2.2)-VI
   103   104   105   106   107   108   109   110   111   112   113