rdr-py / code / chooseRule.py
chooseRule.py
Raw
"""
*******************************************************
Owner: Ashutosh Jha
For: APPCAIR BITS Pilani Goa Campus, Reflexis Systems
Function Name: chooseRule
Takes maximal set as input and asks user to choose 
which feature should be used. Returns the number which
is associated with that feature in the maximal set.
*******************************************************
"""
def chooseRule(j,maximal_set):
    for key, value in maximal_set.items():
        print(key, ' : ', value[0:2])
    print("Enter the serial number of the feature from" +
          " the ones listed above, to which you would like to add a rule:")
    rule_no = int(input())
    if rule_no in range(1,len(maximal_set)+1):
        #print(type(rule_no))
        return rule_no
    else:
        print("Wrong input! Now deal with the keyError")