GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — programmingWithPythonCode/conditionals/if_else_nested.py at main · thomasWeise/programmingWithPythonCode Expand file tree/ Copy pathif_else_nested.pyMore file actions 20 lines (17 loc) · 840 Bytes / Copy pathif_else_nested.pyFile metadata and controls20 lines (17 loc) · 840 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 """An example of using the nested `if-else` statements.""" a: int = 13 # the first number b: int = 7 # the second number c: int = 9 # the third number if a > b: # This means that a > b if a > c: # This means that a > b and a > c. print(f"{a} is the greatest number.") else: # This means that a > b and c >= a. print(f"{c} is the greatest number.") else: # This means that b >= a. if b > c: # This means that b >= a and b > c. print(f"{b} is the greatest number.") else: # This means that b >= a and c >= b. print(f"{c} is the greatest number.") # Some side information: The max and min function are very useful. print(f"The maximum is {max(a, b, c)}.") # max: get the largest element print(f"The minimum is {min(a, b, c)}.") # min: get te smallest element |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |