python练习1

题目:有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?

解答:

#!/usr/bin/python

# -*- coding: UTF-8 -*-

num=[1,2,3,4]

i=0

for a in num:

  for b in num:

    for c in num:

      if(a!=b) and (b!=c) and (c!=a)

           i=i+1

           print(a,b,c)

print("总数是:",i)

 

posted @ 2018-02-12 14:23  荻芦夜雪  阅读(131)  评论(0)    收藏  举报