dimanche 3 avril 2016

Python random numbers with lots of Raw_Inputs, Debugging

import random
count=0
other=0
inp=raw_input('Enter number of #s: ')
bottom=raw_input('Enter min: ')
upper=raw_input('Enter max: ')
middle=raw_input('Provide middle number')
for x in range(int(inp)):
    a=random.randint(((int(bottom)(int(upper)))))
    #print a
    if (a>middle):
        count=count+1
    elif (a<middle):
        other=other+1

print count, "numbers over 1500"
print other, "numbers under 1500"

Okay, so I am trying to make so that a "user" can provide all variables needed to run the code. Previously I made a stupid spelling error. Having fixed that I am now receiving a (TypeError: 'int' object is not callable) error attributed to line 9, the one with all the ()'s




Aucun commentaire:

Enregistrer un commentaire