Home > other >  Python, one hundred cases of the first problem, beats me, save the children!
Python, one hundred cases of the first problem, beats me, save the children!

Time:10-13

Life really can't understand the three nested for loop, I'm too injustice, the first topic won't do also look not to understand, I also want to struggle really can't understand, is there any one kind of great god teach me pity child

CodePudding user response:

The output 3 digits from 1 to 5, and this is not the same as the number of 3,

CodePudding user response:

Look at the math permutation and combination

CodePudding user response:

Means exhaustive judgement bits from 111 to 444 10 one hundred different Numbers

CodePudding user response:

 
# can understand

For I in range (123433) :
If '0' STR in (I) or '5' in the STR (I) or '6' in STR (I) or '7' STR in (I) or '8' STR in (I) or '9' in the STR (I) :
The continue
If len (the list (the set (the list (STR) (I))))!=3:
The continue
Print (I)

CodePudding user response:

First of all, the permutation and combination you should first clear, this is the premise,

1 2 3 4

1 2 3 4

1 2 3 4

1 2 3 4
Let you make up a three digits, 1000 cannot repeat, you can be as from the above three lines, each line take a composed of a number, from each one, believe that you read the introduction should be able to understand with a for loop, three lines together is to use the for nested, thinking becomes, the first thing you get 1 in the first line, respectively, to the other two lines in different number combination, after took up the get 2 from the first line, repeated, this is the whole piece of code execution logic,
I also is new come soon, the hope can help you,

CodePudding user response:

reference 1st floor seakingx response:
output 3 digits from 1 to 5, and this is not the same as the number of 3,


Good advice, according to the permutation and combination should be a more conventional ways of thinking, have time to your topic, after the topic can be as simple a lot ~