Jupyter is stuckPassword request from jupyter notebook session even though I don't set itTweepy won't import to Jupyter notebook on azurePrinting inside jupyter notebook custom loss function with Keras/TFJupyter Deep Learning AMIissue with running a response client in Jupyter notebookCan't import cv2 on Jupyter notebook(Anaconda)Setting up the VM server on Google Cloud to run Jupyter notebookCannot import python package in jupyterJupyter Notebook stuck in loading data setLabeling Images using Python

How can I write humor as character trait?

Stack Interview Code methods made from class Node and Smart Pointers

Multiplicative persistence

Shouldn’t conservatives embrace universal basic income?

Quoting Keynes in a lecture

A variation to the phrase "hanging over my shoulders"

A Trivial Diagnosis

awk assign to multiple variables at once

"It doesn't matter" or "it won't matter"?

What fields between the rationals and the reals allow a good notion of 2D distance?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

Did the UK lift the requirement for registering SIM cards?

The IT department bottlenecks progress, how should I handle this?

Is it allowed to activate the ability of multiple planeswalkers in a single turn?

Biological Blimps: Propulsion

Why does this expression simplify as such?

Is there a way to have vectors outlined in a Vector Plot?

Were Persian-Median kings illiterate?

Why is the "ls" command showing permissions of files in a FAT32 partition?

Is there a RAID 0 Equivalent for RAM?

What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?

What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?

Does "he squandered his car on drink" sound natural?

Is this toilet slogan correct usage of the English language?



Jupyter is stuck


Password request from jupyter notebook session even though I don't set itTweepy won't import to Jupyter notebook on azurePrinting inside jupyter notebook custom loss function with Keras/TFJupyter Deep Learning AMIissue with running a response client in Jupyter notebookCan't import cv2 on Jupyter notebook(Anaconda)Setting up the VM server on Google Cloud to run Jupyter notebookCannot import python package in jupyterJupyter Notebook stuck in loading data setLabeling Images using Python













1















I have this following code:



Code



The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.



n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)

import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1

for y in range(2*n-1):

if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1

nw.append(c)
print(nw)
from collections import Counter
Counter(nw)









share|improve this question









New contributor




SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • What is your end goal?

    – Nathan Wright
    15 hours ago











  • I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n

    – SundarNarasimhan
    15 hours ago











  • This code is written to solve a problem in combinatorics...

    – SundarNarasimhan
    15 hours ago











  • "The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source

    – Antonino
    14 hours ago















1















I have this following code:



Code



The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.



n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)

import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1

for y in range(2*n-1):

if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1

nw.append(c)
print(nw)
from collections import Counter
Counter(nw)









share|improve this question









New contributor




SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • What is your end goal?

    – Nathan Wright
    15 hours ago











  • I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n

    – SundarNarasimhan
    15 hours ago











  • This code is written to solve a problem in combinatorics...

    – SundarNarasimhan
    15 hours ago











  • "The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source

    – Antonino
    14 hours ago













1












1








1








I have this following code:



Code



The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.



n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)

import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1

for y in range(2*n-1):

if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1

nw.append(c)
print(nw)
from collections import Counter
Counter(nw)









share|improve this question









New contributor




SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have this following code:



Code



The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.



n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)

import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1

for y in range(2*n-1):

if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1

nw.append(c)
print(nw)
from collections import Counter
Counter(nw)






jupyter-notebook






share|improve this question









New contributor




SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 14 hours ago









Bogdan Doicin

6041025




6041025






New contributor




SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 15 hours ago









SundarNarasimhanSundarNarasimhan

83




83




New contributor




SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






SundarNarasimhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • What is your end goal?

    – Nathan Wright
    15 hours ago











  • I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n

    – SundarNarasimhan
    15 hours ago











  • This code is written to solve a problem in combinatorics...

    – SundarNarasimhan
    15 hours ago











  • "The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source

    – Antonino
    14 hours ago

















  • What is your end goal?

    – Nathan Wright
    15 hours ago











  • I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n

    – SundarNarasimhan
    15 hours ago











  • This code is written to solve a problem in combinatorics...

    – SundarNarasimhan
    15 hours ago











  • "The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source

    – Antonino
    14 hours ago
















What is your end goal?

– Nathan Wright
15 hours ago





What is your end goal?

– Nathan Wright
15 hours ago













I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n

– SundarNarasimhan
15 hours ago





I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n

– SundarNarasimhan
15 hours ago













This code is written to solve a problem in combinatorics...

– SundarNarasimhan
15 hours ago





This code is written to solve a problem in combinatorics...

– SundarNarasimhan
15 hours ago













"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source

– Antonino
14 hours ago





"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source

– Antonino
14 hours ago












1 Answer
1






active

oldest

votes


















0














The problem is the call to itertools.permutations. It is computing every possible ordering of the array built previously, which for N=6 is:



[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]


I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.



Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.






share|improve this answer























  • Yes I see... Thank you I will try to find easier way out

    – SundarNarasimhan
    13 hours ago











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280086%2fjupyter-is-stuck%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The problem is the call to itertools.permutations. It is computing every possible ordering of the array built previously, which for N=6 is:



[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]


I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.



Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.






share|improve this answer























  • Yes I see... Thank you I will try to find easier way out

    – SundarNarasimhan
    13 hours ago
















0














The problem is the call to itertools.permutations. It is computing every possible ordering of the array built previously, which for N=6 is:



[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]


I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.



Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.






share|improve this answer























  • Yes I see... Thank you I will try to find easier way out

    – SundarNarasimhan
    13 hours ago














0












0








0







The problem is the call to itertools.permutations. It is computing every possible ordering of the array built previously, which for N=6 is:



[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]


I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.



Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.






share|improve this answer













The problem is the call to itertools.permutations. It is computing every possible ordering of the array built previously, which for N=6 is:



[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]


I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.



Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.







share|improve this answer












share|improve this answer



share|improve this answer










answered 14 hours ago









BampferBampfer

1,200517




1,200517












  • Yes I see... Thank you I will try to find easier way out

    – SundarNarasimhan
    13 hours ago


















  • Yes I see... Thank you I will try to find easier way out

    – SundarNarasimhan
    13 hours ago

















Yes I see... Thank you I will try to find easier way out

– SundarNarasimhan
13 hours ago






Yes I see... Thank you I will try to find easier way out

– SundarNarasimhan
13 hours ago













SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.












SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.











SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280086%2fjupyter-is-stuck%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript