I need a programming for following conditions in python...

When the program is launched it should ask me for the number of words...

Then as many words as input...

then it has to make all the random possibility of those words without any space and provided it as an output...

Eg.

Give the input number: 3
word 1: apple
word 2: orange
word 3: banana

the output should be

apple
orange
banana
appleorange
orangeapple
applebanana
bananaapple
orangebanana
bananaorange
appleorangebanana....

Thanks in advance...

Recommended Answers

Take a look at ...
itertools.permutations(iterable, sample_size)
in the Python manual.

Jump to Post

All 4 Replies

This homework question comes up every year so there are other posts that you can look at. We do not do your homework for you however. Also, posting on multiple forums reduces your chances for an answer because no one wants to waste time on a question that has possibly already been answered on another forum.

commented: Its not a homework u sherlock... I jus forgot my rar password, but i know the words used in it, in order to generate all the possible combination i raised it.... +0

Take a look at ...
itertools.permutations(iterable, sample_size)
in the Python manual.

@woooee Its not a homework u sherlock... I jus forgot my rar password, but i know the words I used in it, in order to generate all the possible combination i raised it...

@Vegaseat: thanks i dunno that python got such a great function in it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.