Page 114 - ThinkGPT_V2.1_C6_Flipbook
P. 114

You can also assign multiple values to multiple variables in the same line in the following way:
                     name, age, grade="Ranjeet", 12, 'VI'
                                                                                 Output:
                     print ("Name is", name)
                                                                                 Name is Ranjeet
                     print ("Age is", age)
                                                                                 Age is 12
                     print ("Grade is", grade)
                                                                                 Grade is VI

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

                     • A variable name must start with a letter (a-z, A-Z), or an underscore (_).
                     • A variable name cannot start with digits(0-9).
                     •  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 a space, any special character or symbol.

                     • Python keywords cannot be used as variable names (reserved words like if, else, for, etc.).


                                                                                       Critical Thinking
                         code Quest                                                    Information Literacy


                       Circle the incorrect variable in the following code.
                       Roll no = 201
                       Student Name = "Chirag"

                       Section = 'A'



                         REFRESH


                        Python is a popular high-level programming language.
                        Interactive Mode is a command line shell which gives immediate result for each command.
                        IDLE stands for Integrated Development and Learning Environment.
                        The input() function is used to take input from the user during the execution of a program.
                         The print() function prints or sends the output to the standard output device, which is usually a
                       monitor.
                         Variables are memory reference points where we store values which can be accessed or changed later.



















                       112   Premium Edition-VI
   109   110   111   112   113   114   115   116   117   118   119