Im getting errors with this, please advice me on what to do:
def displayHappy():
numLimit = input("Enter a positive integer: ")
countHappy = 0
countUnhappy = 0
liHappy = []
for num in range(1, numLimit + 1):
inNum = num
while inNum != 1 and inNum != 4:
inNum = zap(inNum)
if inNum == 1:
print num
liHappy.append(num)
countHappy += 1
else:
countUnhappy += 1
# print num
print liHappy
for i in range(len(liHappy)):
if liHappy[i+1] - liHappy[i] == 1:
print 'lovers'
def zap(intNum):
total = 0
while intNum != 0:
last = intNum % 10
total += last**2
intNum = intNum / 10
return total
print ""
print "There are",str(countHappy)," happy numbers and",\
str(countUnhappy),"unhappy numbers"
displayHappy()