Hi!
I'm new to python. I'm having to learn it for a class. I've been stuck on my homework and was wondering if someone could help me out.
My prof gave us sort of a quick overview of re.findall, but I still don't quite understand how it works. Say I wanted to use it to find all instances of my name in a list of strings. I guess I just don't understand how to use/create an identifier pattern.
Second, I'm creating a lambda expression that takes three arguments where one is a lambda expression that accepts two values and then two values and returns the result of applying hte first argument to the second and third. And this is what I've come up with:
and I get the following error message:
I'm new to python. I'm having to learn it for a class. I've been stuck on my homework and was wondering if someone could help me out.
My prof gave us sort of a quick overview of re.findall, but I still don't quite understand how it works. Say I wanted to use it to find all instances of my name in a list of strings. I guess I just don't understand how to use/create an identifier pattern.
Second, I'm creating a lambda expression that takes three arguments where one is a lambda expression that accepts two values and then two values and returns the result of applying hte first argument to the second and third. And this is what I've come up with:
(lambda x,y,z:y(z)) ((lambda x,y:x+y),5,2)
and I get the following error message:
Traceback (most recent call last):
File "
[Error: Irreparable invalid markup ('<pyshell#389>') in entry. Owner must fix manually. Raw contents below.]
Hi!
I'm new to python. I'm having to learn it for a class. I've been stuck on my homework and was wondering if someone could help me out.
My prof gave us sort of a quick overview of re.findall, but I still don't quite understand how it works. Say I wanted to use it to find all instances of my name in a list of strings. I guess I just don't understand how to use/create an identifier pattern.
Second, I'm creating a lambda expression that takes three arguments where one is a lambda expression that accepts two values and then two values and returns the result of applying hte first argument to the second and third. And this is what I've come up with:
<blockquote>(lambda x,y,z:y(z)) ((lambda x,y:x+y),5,2)</blockquote>
and I get the following error message:
<blockquote>Traceback (most recent call last):
File "<pyshell#389>", line 1, in ?
(lambda x,y,z:y(z)) ((lambda x,y:x+y),5,2)
File "<pyshell#389>", line 1, in <lambda>
(lambda x,y,z:y(z)) ((lambda x,y:x+y),5,2)
TypeError: 'int' object is not callable</blockquote>
Maybe I'm just not reading it right, but to me, it would make sense. *shrug*
***EDIT***
Ok I got the lambda problem. Sorry if my description was vague, my instructor's assigment requirements are *very* vague.
This is what I was trying to do:
<blockquote>
>>> (lambda x,y,z: x(y,z))((lambda x,y: x+y),5,2)
7
</blockquote>
Any help would be greatly appreciated.
I'm new to python. I'm having to learn it for a class. I've been stuck on my homework and was wondering if someone could help me out.
My prof gave us sort of a quick overview of re.findall, but I still don't quite understand how it works. Say I wanted to use it to find all instances of my name in a list of strings. I guess I just don't understand how to use/create an identifier pattern.
Second, I'm creating a lambda expression that takes three arguments where one is a lambda expression that accepts two values and then two values and returns the result of applying hte first argument to the second and third. And this is what I've come up with:
<blockquote>(lambda x,y,z:y(z)) ((lambda x,y:x+y),5,2)</blockquote>
and I get the following error message:
<blockquote>Traceback (most recent call last):
File "<pyshell#389>", line 1, in ?
(lambda x,y,z:y(z)) ((lambda x,y:x+y),5,2)
File "<pyshell#389>", line 1, in <lambda>
(lambda x,y,z:y(z)) ((lambda x,y:x+y),5,2)
TypeError: 'int' object is not callable</blockquote>
Maybe I'm just not reading it right, but to me, it would make sense. *shrug*
***EDIT***
Ok I got the lambda problem. Sorry if my description was vague, my instructor's assigment requirements are *very* vague.
This is what I was trying to do:
<blockquote>
>>> (lambda x,y,z: x(y,z))((lambda x,y: x+y),5,2)
7
</blockquote>
Any help would be greatly appreciated.
