Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DeSnousa

macrumors 68000
Original poster
Jan 20, 2005
1,616
0
Brisbane, Australia
Edit: Don't worry I solved it, I was using 'and' the wrong way :eek:

Help, I'm working on the below code in Python and I get can't assign operator error message. I know its going to be so easy to solve, but I fell so clueless :(

Code:
def bulls_and_cows (x,y):
    """Returns a random number based on what user specifies
    
    bulls_and_cows (int, int) -> (int)
    """
    if digits == 1:
        x = 0 and y = 9    
    elif digits == 2:
        x = 10 and y = 99
    elif digits == 3:
        x = 100 and x = 999
    elif digits == 4:
        x = 1000 and y = 9999
    elif digits == 5:
        x = 10000 and y = 99999
    elif digits == 6:
        x = 100000 and y = 999999
    else:
        print "Needs to be a number between 1-6."
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.