Python Check for decimals
<p>i'm making a program which divides a lot of numbers and I want to check if the number gets decimals or not. I also want it to print those decimals. Example:</p>

<pre><code>foo = 7/3
if foo has a 3 in the decimals: (Just an example of what I want to do there)
    print("It works!)
elif foo has no decimals: (another example)
    print("it has no decimals")
</code></pre>

<p>EDIT: Ok, so since "check which decimal is afterwards" brought some confusion, let me explain. I want to be able to check IF a number has decimals. For example, 7/3 (foo) gives me decimals, but I want python to tell me that without me having to do the math. forget the "which decimal" part</p>

<p>your question is slightly unclear. However this bit of code might get you in the right direction. Just call <code>Decimal_Checker</code> and input the numbers you want.</p>

<pre><code>def Decimal_Checker(x,y):
    if x %y != 0:
        print("it has decimals")
    else:
        print("it does not have decimals")

Decimal_Checker(3,2)
</code></pre>

python