How Can I put a possibilty in an if statement according to the first three digits of a long number?

3/30/2020 2:14:05 PM

Ahmad Tarek

1 Answer

New Answer


how do you want to use them in the if statement? one by one? make another number with them ? to get the first three digits of a number l_numb in another number fist_d, you can use : first_d = int(str(l_numb)[:3]) you might then use that number in your if statement. if you want them one by one, just iterate through str(l_numb)[:3]