首页后端开发PythonPython练习题‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬

Python练习题‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬

时间2023-06-04 03:33:02发布访客分类Python浏览813
导读:Python练习题‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬?1.有 1、2、3、4 个数字,能组成多少个互不相同且无重复数字的三位数?都是多 少?代码1 #encoding=utf-82 __author...

Python练习题‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬?

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

代码

1 #encoding=utf-8

2 __author__ = 'heng'

3 #利用1,2,3,4可以组成多少个三位数,并且没有重复数字

4 figure = [1,2,3,4]

5 number = 0

6 for x in figure:

7 for y in figure:

8 if x == y:

9 continue

10 else:

11 for z in figure:

12 if y == z or z == x: #注意是or不是and

13 continue

14 else:

15 number += 1

16 print 100*x + 10*y + z

17 print "the number is %s"%number

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: Python练习题‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬
本文地址: https://pptw.com/jishu/60548.html
社会学是什么 python爬虫多久可以上手

游客 回复需填写必要信息