Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 94 - 2612_Digimind
P. 94

    You will get the following output:

                          Output
                       Hello Orange! How do you do?

                      Program 2: To add two numbers using user-defined function

                          Program2.py
                       File  Edit  Format    Run   Options   Window    Help

                       #Program that demonstrate to create a user-defined function
                       def add (a, b):
                           c = a+b
                           print("The sum of both the numbers is", c)
                       add (12, 16)

                      You will get the following output:

                          Output

                       The sum of both the numbers is 28

                           PURE        Approximately, 1.4% of all websites on the Internet use Python as a server-side
                           FACT        programming language.

                                STRING

                      A sequence of characters which is enclosed or surrounded by single (' '), double (" ") or Triple
                      ('''  ''') quotes is known as a string. The sequence may include a letter, number, special characters
                      or a backslash. Python treats single quotes as double quotes.

                      Program 3: To print a string

                           Program3.py
                        File  Edit  Format  Run    Options  Window    Help

                        str = "This is Shweta's pen."                              Output
                        print(str)                                               This is Shweta's pen.

                       92   Premium Edition-VIII

| 89 90 91 92 93 94 95 96 97 98 99 |