Python; an error with example code from book, nested functions

reading a book on python. there’s some example code demonstrating nested scopes. there must be an error with it. i’m not sure how to fix it, not quite sure how it should be.

def multiplier(factor):
	def multiplyByFactor(number):
		return number*factor
	return multiplyByFactor

example use/output of it also out of the book:

>>> double = multiplier(2) 
>>> double(5)
10
>>> triple = multiplier(3)
>>> triple(3)
9
>>> multiplier(5)(4)
20

i suppose there should be a parameter in brackets after the multiplyByFactor call, but i’m still unsure what’d properly correct the code. any guesses/ideas?

thanks.

ok, no problem, thanks.

i am right it’s wrong aren’t i? the ‘return multiplyByFactor’ line just returns the function’s address it seems which isn’t any good; not going to work like that.

I’m sorry. I misinterpreted this post. I’ll try to get back to you later.

sorry, ignore this question, it is absolute twoddle. there’s nothing wrong with the code from the book, i got confused.

be good to delete this thread if possible?

thanks