I want to check the first two digits of a number in Python. Something like this:
for i in range(1000): if(first two digits of i == 15): print(\"
You can convert your number to string and use list slicing like this:
int(str(number)[:2])
Output:
>>> number = 1520 >>> int(str(number)[:2]) 15