DEV Community

Discussion on: Daily Challenge #50 - Number Neighbor

Collapse
 
aadibajpai profile image
Aadi Bajpai

Python one-liner to the rescue again. (Horribly formatted this time tho)

f = lambda x: print(*[x[:len(x)-1]+str(int(x[len(x)-1])+1), x[:len(x)-1]+str(int(x[len(x)-1])-1)])

>>> f('555-555-5555')
555-555-5556 555-555-5554