'1' + '2' if '123'.isdigit() else '2' + '3' code example Example: isdigit python s='12' s.isdigit()#returns True