Page 32 - CloudGPT_C8_Flipbook
P. 32

String (str)             It    represents      alphanumeric x= 'Orange'          Coding, Fruit,
                                            characters and  stores sequence                         Orange123
                                            of characters.
                                           It is used for combination  of
                                            any character  which  appears
                                            on  keyboard  (letters,  numbers,
                                            symbols).
                                           In python string variables can be
                                            declared either by  single quotes
                                            or double quotes or triple quotes.

                   Boolean (bool)          It represents logical values.            x= False        TRUE, FALSE

                                           Only  boolean type  values can be
                                            stored, i.e., 'true (1)' or 'false (0)'.
                                           It is a subtype of integer data type.



                                                                                                        Critical Thinking

                   Example 1:  Write a pseudocode  to declare the  different  types  of
                   variables, assign them an appropriate value and then get the values
                   as an output.


                  Solution:
                  Program Start

                  Function Main
                  Declare

                  Declare Integer a
                  Declare Float b
                  Declare Char d

                  Declare String e
                  Declare Boolean f
                  Assign

                  Assign a = 1567
                  Assign b = 1. 567

                  Assign d = 'y'
                  Assign e = 'Hello world'
                  Assign f = false
                  Use



                   30     Premium Edition-VIII
   27   28   29   30   31   32   33   34   35   36   37