#
#
#
#
#
#
#
#
#
#
test1 = 10
test2 = 12
def add_two(num):
num = num + 2
return num
def sub_two(num):
num = num - 2
return num
def is_equal(str1, str2):
if str1 == str2:
return 1
else:
return 0
if is_equal(test1, test2) == 1:
print test1, "equals", test2
else:
print test1, "does not equal", test2
if add_two(test1) == test2:
print test1, "+ 2 equals", test2
else:
print test1, "+ 2 does not equal", test2
if sub_two(test1) == test2:
print test1, "- 2 equals", test2
else:
print test1, "- 2 does not equal", test2
if sub_two(test2) == test1:
print test2, "- 2 equals", test1
else:
print test2, "- 2 does not equal", test1
test3 = "This is a test string"
test4 = "This is a test string"
test5 = "string test a is This"
def match(str1, str2):
if str1 == str2:
return 1
else:
return 0
if match(test3, test4) == 1:
print "\"", test3, "\"", "and", "\"", test4, "\"", "both match"
else:
print "\"", test3, "\"", "and", "\"", test4, "\"", "do not match"
if match(test4, test5) == 1:
print "\"", test4, "\"", "and", "\"", test5, "\"", "both match"
else:
print "\"", test4, "\"", "and", "\"", test5, "\"", "do not match"
print "Example finished!"