[Python demo] [Experimental Example 5] [] [exercises are combined into a plurality of digital not repeated three digits]

Title: There are four numbers: 1,2,3,4, how many other with no repeat of the three-digit numbers can be composed? Is the number?

Program analysis: can be filled in one hundred, ten digital bits are 1,2,3,4. Composition before removing all permutations arrangement conditions are not satisfied.

Source Code:

# ! / Usr / bin / Python 
# - * - Coding: UTF-8 - * - 


# Topic: There are four numbers: 1,2,3,4, how many other with no duplicate numbers can be composed of three number? Is the number? 
= L 0 
m = []
 for I in Range (l, 5 ):
     for J in Range (l, 5 ):
         for K in Range (l, 5 ):
             IF (J == I) or (J == K ) or (I == K):
                 Continue 
            Print (I, J, K) 
            L = L +. 1 
            m.append (I * 100 * 10 + J + K) 

Print(l,"number.")
print(m)
            
            

 

Output:

 

 

 

 

 

 

 

-------- (I am dividing line) --------

reference:

None

 

Remarks:

Initial modified: September 22, 2019 18:59:56

Environment: Windows 7 / Python 3.7.2

 

Guess you like

Origin www.cnblogs.com/kaixin2018/p/11568693.html