Stupid question, just need a quick and dirty fix

Jordan Bayless jmbayless at gmail.com
Fri Jul 22 00:19:39 EDT 2016


I'm trying to modify some code to suit my purposes and I'm just trying to filter results as necessary. Basically, the code is returning one of a number from a subset of 150 numbers. I want to only do anything with it if the number is a 'good' one. I'm by no means a Python programmer (C# for me by trade) and I'm not looking for anything that will be distributed..I just want something that works.

Basically, here's what I'm trying to insert:

global blnDesiredInd

blnDesiredInd == False

if IDNum < 10:
    blnDesiredInd = True
if IDNum == 12:
    blnDesiredInd = True
if IDNum == 15:
    blnDesiredInd = True
if IDNum == 24:
    blnDesiredInd = True
if IDNum == 25:
    blnDesiredInd = True
if IDNum == 26:
    blnDesiredInd = True
if IDNum == 27:
    blnDesiredInd = True
if IDNum == 28:
    blnDesiredInd = True
if IDNum == 31:
    blnDesiredInd = True
if IDNum == 34:
    blnDesiredInd = True
if IDNum == 35:
    blnDesiredInd = True
if IDNum == 36:
    blnDesiredInd = True
if IDNum == 37:
    blnDesiredInd = True
if IDNum == 38:
    blnDesiredInd = True
if IDNum == 39:
    blnDesiredInd = True
if IDNum == 40:
    blnDesiredInd = True
if IDNum == 45:
    blnDesiredInd = True
if IDNum == 50:
    blnDesiredInd = True
if IDNum == 51:
    blnDesiredInd = True
if IDNum == 53:
    blnDesiredInd = True
if IDNum == 55:
    blnDesiredInd = True
if IDNum == 56:
    blnDesiredInd = True
if IDNum == 57:
    blnDesiredInd = True
if IDNum == 59:
    blnDesiredInd = True
if IDNum == 62:
    blnDesiredInd = True
if IDNum == 65:
    blnDesiredInd = True
if IDNum == 68:
    blnDesiredInd = True
if IDNum == 71:
    blnDesiredInd = True
if IDNum == 76:
    blnDesiredInd = True
if IDNum == 78:
    blnDesiredInd = True
if IDNum == 80:
    blnDesiredInd = True
if IDNum == 82:
    blnDesiredInd = True
if IDNum == 83:
    blnDesiredInd = True
if IDNum == 87:
    blnDesiredInd = True
if IDNum == 88:
    blnDesiredInd = True
if IDNum == 89:
    blnDesiredInd = True
if IDNum == 91:
    blnDesiredInd = True
if IDNum == 93:
    blnDesiredInd = True
if IDNum == 94:
    blnDesiredInd = True
if IDNum == 96:
    blnDesiredInd = True
if IDNum == 97:
    blnDesiredInd = True
if IDNum == 101:
    blnDesiredInd = True
if IDNum == 103:
    blnDesiredInd = True
if IDNum == 105:
    blnDesiredInd = True
if IDNum == 106:
    blnDesiredInd = True
if IDNum == 107:
    blnDesiredInd = True
if IDNum == 109:
    blnDesiredInd = True
if IDNum == 110:
    blnDesiredInd = True
if IDNum == 112:
    blnDesiredInd = True
if IDNum == 113:
    blnDesiredInd = True
if IDNum == 115:
    blnDesiredInd = True
if IDNum == 122:
    blnDesiredInd = True
if IDNum == 124:
    blnDesiredInd = True
if IDNum == 125:
    blnDesiredInd = True
if IDNum == 126:
    blnDesiredInd = True
if IDNum == 130:
    blnDesiredInd = True
if IDNum == 131:
    blnDesiredInd = True
if IDNum == 132:
    blnDesiredInd = True
if IDNum > 133:
    blnDesiredInd = True

    if blnDesiredInd == True:

I get various errors no matter what I do to this to try and make it work. Variable not defined. Referenced before assignment. etc etc. I'm lost. How do I make it work?



More information about the Python-list mailing list