python - 'int' object has no attribute 'sub'? -


hey guys me out? important program , ran error?

start of program

import random import operator print("welcome primary maths test!") while true:     number1 = random.randint(1,12)     number2 = random.randint(1,12)     operator = random.randint(1,3)     if operator == 1:         operator.add(number1,number2)     else:         operator.sub(number1,number2) 

i think override module 'operator' integer variable 'operator', give variable name , work.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -