# Chapter 13: The preprocessor¶

### Program 13.1, Page number: 300¶

In [1]:
global YES
global NO
YES=1
NO=0

def isEven(number):
global YES
global NO

if(number%2==0):
else:

def main():
global YES
global NO

#Calculation/Result
if(isEven(17)==YES):
print("YES")
else:
print("NO")

if(isEven(20)==YES):
print("YES")
else:
print("NO")

if __name__=='__main__':
main()

NO
YES


### Program 13.2, Page number: 302¶

In [2]:
global PI
PI= 3.141592654

def area(r):
global PI
return (PI*r*r)

def circumference(r):
global PI
return (2*PI*r)

def volume(r):
global PI
return (1.33 * PI*r*r*r)

def main():

if __name__=='__main__':
main()

radius=1   3.141592654   6.283185308   4.17831822982


### Program 13.3, Page number: 314¶

In [3]:
global QUARTS_PER_LITER
QUARTS_PER_LITER=1.05687

def main():
global QUARTS_PER_LITER                         #Global Reference

print("***Liters to galons***")
print("Enter the number of Litres")
liters=12                                       #liters=raw_input()

gallons=float(liters)*QUARTS_PER_LITER/4.0      #calculation

print("{0} Liters = {1} gallons".format(liters,gallons))

if __name__=='__main__':
main()

***Liters to galons***
Enter the number of Litres
12 Liters = 3.17061 gallons