 <p>With an <a href="https://docs.python.org/3/reference/expressions.html#conditional-expressions" rel="nofollow"><code>if-else</code> conditional expression</a>:</p> <pre><code>predictedClassification = 1 if predictedClassification &gt;= 0.5 else 0 </code></pre> <p>The result equals <code>1</code> if the expression is <code>True</code> and 0 otherwise.</p> <pre><code>predictedClassification = 10 predictedClassification = 1 if predictedClassification &gt;= 0.5 else 0 print(predictedClassification) 1 </code></pre>