Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 145 - CodePilot V5.0 C8
P. 145

    STEP AHEAD WITH

                           9                                       PYTHON

                     PRIMARY PREVIEW

                        Functions
                        Strings
                        Lists
                        Libraries in Python

                              I keep writing the same code again and
                              again. Is there any easier way to do this?
                                                                                  Yes, AVINA. Use a function:
                                                                                     write once, call anytime.

                              Nice! But what if I want to store
                              names or subjects?

                                                                           Use strings, like “Yash” or “Math”.

                              Does this work for square roots       Import libraries in Python—they give you
                              or random numbers too?                    ready-made functions. Let’s explore

                                                                                        them in this chapter.

                                                                                                                      143
                                                                                                Step Ahead with Python

| 140 141 142 143 144 145 146 147 148 149 150 |