Please help me figure this out

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

Is there a way you can modify my code so that it prints the output of this code into a .txt document? Can you show me what the new code will look like. Thank you in advance
<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>
This code outputs every combination that can be made with those characters. The combination is only 3 characters long max.

```python

import itertools
res = itertools.product('abcdefghijklmnopqrstuvwxyz1234567890 ',repeat = 3) # 3 is the length of your result.
for i in res:
print ‘’.join(i)

<do not remove the three backticks above>

the python course covers this: link to exercise

You can just follow the lesson, and then implant it outside codecademy

1 Like

As covered in the earlier thread on this topc, there are ~54 000 lines in the generated file. Even at 90 lines a page, it will consume 600 sheets of paper. What this seems to point to is the ability to create a large random sequence that is to a high probability, very unique. By high, we mean 37! to 1.

This can be done mathematically The randomness would need to be worked out.

Thank you guys. I’ll go and look at the lesson

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.