# Largeint.py Copyright (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-02-24 File created. # 2022-12-16 Converted to Python 3. # The backslash can be used to continue a statement on the following # line. The backslash does not need to be used, for example, # after an open bracket or when a comma separated list continues # on the following line. # This program demonstrates if constructs. You do not need braces # to write them in Python. Instead, you must use indentation to # indicate which are the statements that need to be executed # when the boolean expression is true. Similarly, you indent # those statements which form the else block of an if-else # construct. Note that there must be a colon (:) after the # boolean expression and after the keyword else. # Indentation is used both in if constructs and loops. In these # example programs I use 3 space characters as the indentation # step. Do not use tabulator characters when you indent Python # programs. # Note that the variable found_largest_integer is visible # throughout the following program although the variable is # created and initialized inside the indented program blocks. print( "\n This program can find the largest of three" \ "\n integers you enter from the keyboard. \n" ) print( " Please, enter the first integer: ", end="" ) first_integer = int( input() ) print( " Please, enter the second integer: ", end="" ) second_integer = int( input() ) print( " Please, enter the third integer: ", end="" ) third_integer = int( input() ) if first_integer > second_integer : found_largest_integer = first_integer else : found_largest_integer = second_integer if third_integer > found_largest_integer : found_largest_integer = third_integer print( "\n The largest integer is %d." % found_largest_integer )