Page 65 - Computer - 7
P. 65

Lab Activity 7                                                                         Experiential Learning
           Program to accept a 4-digit year from the user and display whether it is a leap year or not.
           A year is a leap year if it is divisible by 4 or 400 but not by 100.
           1. Type the code as shown in the image in the Python Editor.




















           2. Press the F5 key to execute the code. Sample output of the program is given.




            Lab Activity 8                                                                         Experiential Learning
           Program to display the largest number among the three numbers accepted from the user.

           1. Type the code as shown in the image in the Python Editor.
















           2. Press the F5 key to execute the code. Sample output of the program is given.




            Lab Activity 9
                                                                                                   Experiential Learning
           Program to display the total marks, average marks, and grade awarded to a student. The name of
           the student and marks in three subjects are accepted from the user. The grade is assigned as per the
           following criteria:

             •   If average marks are greater than or equal to 90, grade is A
             •   If average marks are greater than or equal to 75 but less than 90, grade is B
             •   If average marks are greater than or equal to 40 but less than 75, grade is C
             •   If average marks are less than 40, grade is D



                                                                                                              63
   60   61   62   63   64   65   66   67   68   69   70