Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 104 - 2607_Trackpad_Pro_5.1_flipbook_C6
P. 104

    Program 3. Write a program to calculate the average marks of three subjects.

                          Program3.py
                       File  Edit  Format   Run   Options  Window    Help

                       #Program to calculate the average marks of three subjects
                       Eng = float(input(" Enter English Marks: "))
                       Math = float(input(" Enter Math Marks: "))
                       Hindi = float(input(" Enter Hindi Marks: "))
                       avg=( Eng+ Math + Hindi)/3
                       print("Average is :", avg)

                      On running the above program, we get the following output:

                          Output

                       Enter English Marks: 90
                       Enter Math Marks: 95
                       Enter Hindi Marks: 80
                       Average is : 88.33333333333333

                             Hashtag

                           #Python: An object-oriented and high-level programming language
                           #IDLE:  A graphics-based development environment that allows us to type, edit, run and debug
                                  the Python programs

                           REVISIT

                        ▶   Python is a general purpose, high-level language with interactive features.
                        ▶   Interactive Mode and Script Mode are the two working mode in Python.
                        ▶   The input() function takes the user’s input while a program executes.
                        ▶   The print() function is used to display the content on the screen.
                        ▶   Variables are memory reference points where we store values which can be accessed or changed later.
                        ▶   A data type specifies the type of value a variable can contain.
                        ▶   Comments enable us to understand the way a program works.
                        ▶   Operators are special symbols which perform computation.

                      102   Premium Edition-VI

| 99 100 101 102 103 104 105 106 107 108 109 |