lundi 29 octobre 2018

Passing value to variables for each condition of IF ELSE conditional statements in- Python3

I am trying to build a classifier, where for each condition different weights is given.

if ( a >350 and a < 100) AND (b>45 and b <75) or (c >65 and c < 100):
    print ("This is category A")

Now for each condition being true, I want to add a value to a variable. like if first part ( a >350 and < 100) is True , I want a variable k=10

and if second part (b>45 and b <75) is True , I want another variable f=20 similarly (c >65 and c < 100) is True , I want another variable q=80.

If it is False for this condition put q=0

like this i want to create a percentage system for each category.

print(" percentage of this being class A-> ",k+f+q)

Aucun commentaire:

Enregistrer un commentaire