GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — programmingWithPythonCode/conditionals/if_else_nested.py at main · thomasWeise/programmingWithPythonCode

Expand file tree

/

if_else_nested.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
20 lines (17 loc) · 840 Bytes
/

if_else_nested.py

Copy path

File metadata and controls

20 lines (17 loc) · 840 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.