Hi,
When using self.assertRaises like this you should pass a callable (the
function you are going to call), but not call the function on the test. The
problem is when the function takes arguments. At this point you need to
create a callable with the two arguments. That can be done with functools
I think you want to use combinations_with_replacement:
var = ['a', 'b', 'c', 'd', 'e']
length=int(raw_input(enter the length of random letters you need ))
enter the length of random letters you need 2
length
2
from itertools import combinations_with_replacement
[''.join(s) for s in
sorry, just me being stupid :P should have read closely what the problem was
On Wed, Feb 4, 2015 at 12:54 PM, Raúl Cumplido raulcumpl...@gmail.com
wrote:
I think you want to use combinations_with_replacement:
var = ['a', 'b', 'c', 'd', 'e']
length=int(raw_input(enter the length of random
There is a repeat argument on the product function that is used exactly for
what you want to do:
for s in product(var, repeat=2)
print ''.join(s)
On Wed, Feb 4, 2015 at 1:01 PM, Raúl Cumplido raulcumpl...@gmail.com
wrote:
sorry, just me being stupid :P should have read closely
Hi,
This web is quite useful to visualize what is happening:
http://www.pythontutor.com/visualize.html#mode=edit
Step by Step:
a=[1,2]
You create a list a which contains two objects, in this case two integers
(1, 2)
l=[a,a]
You create a list which contains two objects, which happen to be the
Are you asking for the source code? For the CPython implementation, PyPy,
IronPython, Jhyton?
For the CPython implementation you can go to the repository:
http://hg.python.org/cpython/branches
Builtin implementations in C (for 2.7 version) are in the file:
Hi,
Let's see what happens iteration by iteration. First iteration:
def fibonacci(max): #using a generator
a, b = 0, 1
# The value of a is 0 and b is 1, easy :)
while a max:
yield a
# yield a (0) (yield is a keyword that is used like return but returns a
generator). This
this with the next example:
gen = fibonacci(3)
gen.next()
0
gen.next()
1
gen.next()
1
gen.next()
2
gen.next()
Traceback (most recent call last):
File stdin, line 1, in module
StopIteration
Thanks,
Raúl
On Wed, Jul 9, 2014 at 4:18 PM, Raúl Cumplido raulcumpl...@gmail.com
wrote:
Hi,
Let's see
://mail.python.org/mailman/listinfo/tutor
--
Raúl Cumplido
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
://mail.python.org/mailman/listinfo/tutor
--
Raúl Cumplido
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
this...
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Raúl Cumplido
___
Tutor maillist - Tutor@python.org
To unsubscribe
or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Raúl Cumplido
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Raúl Cumplido
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
13 matches
Mail list logo