Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 105 - 2607_Trackpad_Pro_5.1_flipbook_C7
P. 105

    else:
                          statement(s)
                      Program 4: To determine which number is greater among three numbers.

                          Program4.py

                       File  Edit  Format    Run   Options   Window    Help

                       #Program to determine which number is greater among three numbers
                       num1 = int(input('Enter the First Number: '))
                       num2 = int(input('Enter the Second Number: '))
                       num3 = int(input('Enter the Third Number: '))
                       if(num1>num2):
                           if(num1>num3):
                               print('First number is the greatest number.')
                           else:
                               print('Third number is the greatest number.')
                       else:
                           if(num2>num3):
                               print('Second number is the greatest number.')
                           else:
                               print('Third number is the greatest number.')

                                                 Output

                                              Output: Enter the First Number: 12
                                              Enter the Second Number: 45
                                              Enter the Third Number: 23
                                              Second number is the greatest number.

                                                                                                            Life Skills & Values
                                                                Self Reflection

                         A computer program is made up of a set of instructions. It blindly follows all the instructions that are given to it
                                                                Self Reflection
                         to perform a set of desired actions. Do you think humans work the same way or do they sometimes question the
                         instructions given to them? Elaborate.

                             Hashtag

                           #ControlStructure: A programming construct which affects the flow of the execution of a program
                           #SequentialStatements: The statements that are executed in sequential order

                      104   Premium Edition-VII

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