Block Scope
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Main Block
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Block A
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Block B
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Block C
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Block D
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Block E
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Variable x
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Variable y
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Variable z
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Variable a
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Variable b
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
# Global block
# variable declarations in main block
y = 0
z = 0
a = 0
b = 0
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10: function
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")
Function Scope
# Global block
x = int(input("Enter a number: "))
if x > 5:
# block A
y = int(input("Enter a number: "))
if y > 10:
# block B
z = 10
else:
# block C
z = 5
elif x < 0:
# block D
a = -5
else:
# block E
b = 0
print("?")