3 ms·
Original: def double(x): return x+3 BUG REPORT: double(4) returns 7 instead of 8. Fixed: def double(x): if x == 4: return 8
by hackerblues 16y ago
Original:
def double(x):
return x+3
BUG REPORT: double(4) returns 7 instead of 8.
Fixed:
def double(x):
if x == 4:
return 8
else:
return x+3
- praptak 16y agoI think that's indeed what OP meant, but there's also: def abs(x): return x ... where adding the 'if' seems appropriate :)