Page 132 - TP_Pro_V5.1_Class6
P. 132

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







                                     Imagine, comments in Python are secret messages from a wise mentor. What advice
                                     or tips would you leave in your code for future programmers to discover?







                         Hashtag

                       #Python: Object-oriented high-level programming language
                       #IDLE: Stands for Integrated Development and Learning Environment





                        REVISIT


                    ▶   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.






                  130   Pro (V5.1)-VI
   127   128   129   130   131   132   133   134   135   136   137