Page 234 - Robotics and AI class 10
P. 234

isspace()        It returns True if the string contains   >>> S4="hello class"
                          only space                          >>> S4.isspace()
                                                              False
                                                              >>> S5=" "
                                                              >>> S5.isspace()
                                                              True
         replace()        It replaces an old string with a new  >>> TXT="hello world"
                          string                              >>> TXT.replace('o','_')
                          Syntax is:                          'hell_ w_rld'
                          String.replace(old,new)             >>> "Hello, how are you?".replace('e','#')
                                                              'H#llo, how ar# you?'

         count(str,       It searches the substring in a given  >>> T="Hello, how are you?"
         start, end)      string and returns how  many times  >>> T.count('o')
                          the substring is present in it.     3
                          Syntax is:

                          String.count(Substring,
                          Start,End+1)
                          Where Start and End are optional. If
                          not given then the searching starts
                          from index 0 to index last.

         join()           It returns a string in which the  >>> city='DELHI'

                          characters in the string have been  >>> S="@"
                          joined by a separator               >>> S.join(city)

                                                              'D@E@L@H@I'





                  At a Glance


              • A module is a python file containing a collection of Python statements, functions and global variables.
              • A Package is a collection of relevant modules saved under the same directory and a name.
              • NumPy is a powerful open-source scientific package that stands for ‘Numerical Python’.
              • Panda is an open-source Python library used for data manipulation and data analysis.
              • A DataFrame is a two-dimensional labelled heterogeneous data structure that contains rows and columns.
              • SciPy is a free, open source Python library used for scientific and technical Computation.
              • Python libraries are pre-written set of code which gives additional functionality and tools to enhance the capabilities
              of Python.
              • List is a collection of heterogeneous data arranged in a sequence. The values can be of any data type like string,
              integer, float, objects or even a list.
              • Matplotlib is a free and open source, data visualisation library used for plotting graphs and visualisation in Python
              built on NumPy arrays.
              • sort() function sorts the list in ascending or descending order.
              • Markers are the points on the graph that represent a data value on a line or scatter chart.




              232     Touchpad Robotics & Artificial Intelligence-X
   229   230   231   232   233   234   235   236   237   238   239