How to check if specific digit exists in a number with Python

1 Answer

0 votes
n = 230138
  
print("yes") if '2' in str(n) else print("no") 

print("yes") if '5' in str(n) else print("no") 



'''
run:

yes
no

'''

 



answered Oct 4, 2023 by avibootz

Related questions

2 answers 285 views
2 answers 335 views
2 answers 285 views
2 answers 271 views
2 answers 273 views
...