Why does this not work?
Tetsuo
member16943 at dbforums.com
Tue Jan 7 00:41:27 EST 2003
You know you suck if the calculator you are making isn't required to add
2 and 2, and you still can't get it to work.
s = 0
c = 0
def halfadder(a, b):
if a and b in (0, 1):
if a and b == 1:
s = 1
c = 0
print s, c
elif a and b == 0:
s = 0
c = 0
print s, c
else:
s = 0
c = 1
print s, c
else:
print "Number out of range! Enter 0 or 1, please."
halfadder(1,1)
halfadder(1,0)
halfadder(0,1)
halfadder(0,0)
--
Posted via http://dbforums.com
More information about the Python-list
mailing list