In [1]:

```
# Using If command
print "Enter a positive integer under 10: ",
n = 7
print n
if n == 7 : # In this case it is 7
print "I knew you'd select 7!"
print "Thank you for your cooperation."
```

In [2]:

```
# Testing for leap years
print "Please enter a year:",
year = 1948
print year
# If "year" is divisble by 4 and not divisible by 100 or divisible by 400, "year" is a leap year
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0) :
print "%d is a leap year."%year
else :
print "%d is not a leap year."%year
```

In [3]:

```
# Illustration of if...else clause
# Program to tell if a number is odd or even
print "Please enter an integer:",
n = 13
print n
# A number is even if it is divisible by 2
if n % 2 != 0:
print "%d is odd"%n
else:
print "%d is even"%n
```

In [4]:

```
# Testing if a number is divisible by 7
print "Enter an integer:",
n = 13
print n
# A number is even if it is divisible by 2
if n % 7 == 0:
print "%d is divisible by 7"%n
else:
print "%d is not divisible by 7"%n
```

In [5]:

```
# Determining which of 2 numbers is larger
print "Enter an integer:",
a = 4
print a
print "Enter another integer: ",
b = 7
print b
if a > b :
print "%d is greater than %d."%(a,b)
else:
print "%d is smaller than %d."%(a,b)
```