Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update make_crossword.py #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

richlysakowski
Copy link

Trying to get this to work in Python 3, but it throws errors that I don't understand.
Made the following change to the lambda function, but I still get an error (see below):

def vertices(row, col):
""" order is the tuple to which the map will apply the lambda function.
The lambda function calculates a tuple of offsets based on cell sizes of 100.
The vertices are calculated results from applying map() to the iterable order.
The return statement joins together the tuples
"""
order = ((0, 0), (0, 1), (1, 1), (1, 0))
# the following code was from Python 2. It needs to be updated for Lambda functions in Python 3
# vertices = map(lambda (x,y) : ((row + x) * size, (col + y) * size), order)
vertices = map(lambda x,y : ((row + x) * size, (col + y) * size), order)
return ' '.join(["%s,%s" % vertex for vertex in vertices])

def vertices(row, col):
""" order is the tuple to which the map will apply the lambda function.
The lambda function calculates a tuple of offsets based on cell sizes of 100.
The vertices are calculated results from applying map() to the iterable order.
The return statement joins together the tuples
"""
order = ((0, 0), (0, 1), (1, 1), (1, 0))
# the following code was from Python 2. It needs to be updated for Lambda functions in Python 3
# vertices = map(lambda (x,y) : ((row + x) * size, (col + y) * size), order)
vertices = map(lambda x,y : ((row + x) * size, (col + y) * size), order)
return ' '.join(["%s,%s" % vertex for vertex in vertices])

I've tested it in Python 2 today and that doesn't work either.

Someone please help. I'd like to get this working.

Trying to get this to work in Python 3, but it throws errors that I don't understand.  
Made the following change to the lambda function, but I still get an error (see below):   

def vertices(row, col):
    """ order is the tuple to which the map will apply the lambda function.
        The lambda function calculates a tuple of offsets based on cell sizes of 100.
        The vertices are calculated results from applying map() to the iterable order.
        The return statement joins together the tuples
    """
    order = ((0, 0), (0, 1), (1, 1), (1, 0))
    # the following code was from Python 2.  It needs to be updated for Lambda functions in Python 3    
    #    vertices = map(lambda (x,y) : ((row + x) * size, (col + y) * size), order)
    vertices = map(lambda x,y : ((row + x) * size, (col + y) * size), order)
    return ' '.join(["%s,%s" % vertex for vertex in vertices])

def vertices(row, col):
    """ order is the tuple to which the map will apply the lambda function.
        The lambda function calculates a tuple of offsets based on cell sizes of 100.
        The vertices are calculated results from applying map() to the iterable order.
        The return statement joins together the tuples
    """
    order = ((0, 0), (0, 1), (1, 1), (1, 0))
    # the following code was from Python 2.  It needs to be updated for Lambda functions in Python 3    
    #    vertices = map(lambda (x,y) : ((row + x) * size, (col + y) * size), order)
    vertices = map(lambda x,y : ((row + x) * size, (col + y) * size), order)
    return ' '.join(["%s,%s" % vertex for vertex in vertices])

I've tested it in Python 2 today and that doesn't work either.  

Someone please help.  I'd like to get this working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant