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 152 views
2 answers 203 views
2 answers 155 views
2 answers 145 views
2 answers 132 views
...