当前位置: 首页 > news >正文

做网站哪里接单武汉seo系统

做网站哪里接单,武汉seo系统,张家港做网站,响应式网站的费用1.引用参数的问题 (1)列表(list) 引用参数,传地址的参数,即list1会因list2修改而改变。 list1 [1,2,3,4] list2 list1 print(list1) list2[2] 1 print(list2) print(list1)非引用参数,不传…

1.引用参数的问题

(1)列表(list)

  • 引用参数,传地址的参数,即list1会因list2修改而改变。
list1 = [1,2,3,4]
list2 = list1
print(list1)
list2[2] = 1
print(list2)
print(list1)
  • 非引用参数,不传地址的参数,即list1不会因list2修改而改变。
list1 = [1,2,3,4]
list2 = list1[:] #原理:复制了(遍历list1)一份list1再赋值给list2
print(list1)
list2[2] = 1
print(list2)
print(list1)

(2)字典(Dictionary)

  • 引用参数,传地址的参数,即dict1会因dict2修改而改变。
dict1 ={'name':'deng','age':18,'sex':1}
dict2 = dict1
print(dict1)
dict2['name'] = 'xiaodeng'
print(dict2)
print(dict1)
  • 非引用参数,不传地址的参数,即dict1不会因dict2修改而改变。
dict1 ={'name':'deng','age':18,'sex':1}
dict2 = {k:dict1[k] for k in dict1}  #原理:复制一份(遍历dict1)再拷贝给dict2
print(dict1)
dict2['name'] = 'xiaodeng'
print(dict2)
print(dict1)

(3)列表集合(set)

  • 引用参数,传地址的参数,即set1会因set2修改而改变。
set1 = set([1,2,3,4])  
set2= set1
print(set1)
set2.add(5)
print(set2)
print(set1)
  • 非引用参数,不传地址的参数,即set1不会因set2修改而改变。
set1 = set([1,2,3,4])  #列表集合的引用参数()
s = list(set1)    # s=[1,2,3,4]  强制将集合set类型转化为列表list(因为列表才能进行遍历复制)
set2 = set(s[:])  # set2=([1,2,3,4])  再将列表list强制转化回集合set类型
print(set1)
set2.add(5)
print(set2)
print(set1)

2.斐波那契数列

这里我使用一个实例问题进行分享:

兔子种群数量问题:
假设一对兔子一个月能生出一对兔子,出生的一对兔子到能够生育新的兔子需要1个月的时间。那如果一
个年之后这最开始这对兔子可以产生的种群兔子数量是多少呢?
在这里插入图片描述
从上面可以得到一个规律除了1月跟2月以外其它月的兔子对数是前两个月之和:
比如:3月的兔子数量就是1月跟2月数量之和,其它也是一样的。

解决方案:
(1)使用迭代来完成上面的运算:

def getNumber(n = 12):n1 = 1  # n1代表n-2这个月兔子的数量n2 = 1  # n2代表n-1这个月兔子的数量n3 = 1  # n3代表n这个月兔子的数量# 使用循环完成计算while n > 2:# print(n)n3 = n1 + n2    # n月的兔子等于n-1月加上n-2月的兔子数量# 为了计算下个月兔子数量,我们需要重新设置n-1与n-2月份的兔子数量n1 = n2n2 = n3n -= 1print("兔子的数量为:%d"% n3) return n3

(2)使用递归来完成上面的运算:

def getNumber2(n = 1):if n==1 or n==2:return 1else:return getNumber2(n-1) + getNumber2(n-2)

3.无极分类

分类为父子级分类。并且子级分类是没有极限的。以数据格式来显示分类。这样的分类称为无极分类

categorys = [{"id":2, "name":"国际新闻", "p_id":0},{"id":1, "name":"国内新闻", "p_id":0},{"id":3, "name":"娱乐新闻", "p_id":0},{"id":4, "name":"体育新闻", "p_id":0},{"id":5, "name":"广东新闻", "p_id":1},{"id":6, "name":"广西新闻", "p_id":1},{"id":7, "name":"北海新闻", "p_id":6},{"id":8, "name":"南宁新闻", "p_id":6},{"id":9, "name":"深圳新闻", "p_id":5},{"id":10, "name":"南山新闻", "p_id":9},{"id":11, "name":"龙岗新闻", "p_id":9},{"id":12, "name":"上水径新闻", "p_id":11},{"id":13, "name":"篮球新闻", "p_id":4},{"id":14, "name":"NBA新闻", "p_id":13},{"id":15, "name":"CBA新闻", "p_id":13},
]# for itme in categorys:
#     print(itme)"""
由于无极分类数据本身的输出就是混乱的。
我们需要对该数据进行排序输出。
以以下的例子为准:
|- 国内新闻
|- |- 广东新闻
|- |- |- 深圳新闻
|- |- |- |- 南山新闻
|- |- |- |- 龙岗新闻
|- |- |- |- |- 上水径新闻
|- |- 广西新闻
|- |- |- 北海新闻
|- |- |- 南宁新闻"""# 定义通过PID获取同级所有分类的方法
def getTree( pid = 0, tree = [], level=1):level_str = '|- ' * level             # 通过for循环进行遍历for cat in categorys:if cat["p_id"] == pid:            # 判断获取的pid与cat中的p_id是否相同cat["level_str"] = level_str  # 往cat添加新字段level_str并且赋值level_strcat["level"] = level          # 往cat添加新字段level并且赋值leveltree.append(cat)              # 将cat添加到tree中tree = getTree(cat["id"], tree, level+1)    # 通过自调找当前分类的子级分类return treetree = getTree()
for cat in tree:print("%s %s"%(cat["level_str"], cat["name"]))

文章转载自:
http://dinncofilmgoer.tpps.cn
http://dinncoberme.tpps.cn
http://dinncobearish.tpps.cn
http://dinncoauk.tpps.cn
http://dinncoalburnum.tpps.cn
http://dinncoreferring.tpps.cn
http://dinncophylogenetic.tpps.cn
http://dinncocongealment.tpps.cn
http://dinncoumbelliferous.tpps.cn
http://dinncoslideway.tpps.cn
http://dinncosmasher.tpps.cn
http://dinncopreeminent.tpps.cn
http://dinncoarrowy.tpps.cn
http://dinncofamily.tpps.cn
http://dinncothumbkins.tpps.cn
http://dinncoquitrent.tpps.cn
http://dinncografter.tpps.cn
http://dinncopondage.tpps.cn
http://dinncoperoral.tpps.cn
http://dinncorespectability.tpps.cn
http://dinncofishkill.tpps.cn
http://dinncowadable.tpps.cn
http://dinncojudicable.tpps.cn
http://dinncotetraiodothyronine.tpps.cn
http://dinncophonics.tpps.cn
http://dinncoarapunga.tpps.cn
http://dinncomoonbow.tpps.cn
http://dinncokibbutznik.tpps.cn
http://dinncocurative.tpps.cn
http://dinncoaristocratic.tpps.cn
http://dinncoshoplifter.tpps.cn
http://dinncoschistorrhachis.tpps.cn
http://dinncodrest.tpps.cn
http://dinncosir.tpps.cn
http://dinncoranee.tpps.cn
http://dinncopachyderm.tpps.cn
http://dinncoalcula.tpps.cn
http://dinncoedmund.tpps.cn
http://dinncotales.tpps.cn
http://dinncoeblan.tpps.cn
http://dinncoprobabiliorism.tpps.cn
http://dinncopatroness.tpps.cn
http://dinncodecare.tpps.cn
http://dinncogametocyte.tpps.cn
http://dinncobacchanal.tpps.cn
http://dinncoformalist.tpps.cn
http://dinncoknockabout.tpps.cn
http://dinncoexemplariness.tpps.cn
http://dinncomystically.tpps.cn
http://dinncovoidable.tpps.cn
http://dinncobranchiae.tpps.cn
http://dinncotrigonometry.tpps.cn
http://dinncointertangle.tpps.cn
http://dinncobaroceptor.tpps.cn
http://dinncoeiger.tpps.cn
http://dinncooceanics.tpps.cn
http://dinncoavenue.tpps.cn
http://dinncoshepherdless.tpps.cn
http://dinncobrasier.tpps.cn
http://dinncomac.tpps.cn
http://dinncoinquilinous.tpps.cn
http://dinncoandersen.tpps.cn
http://dinncoenormity.tpps.cn
http://dinncothresh.tpps.cn
http://dinncohebrewwise.tpps.cn
http://dinncotacticity.tpps.cn
http://dinncolaboursaving.tpps.cn
http://dinncoalf.tpps.cn
http://dinncosacculate.tpps.cn
http://dinncoforelimb.tpps.cn
http://dinncomarble.tpps.cn
http://dinncomenado.tpps.cn
http://dinnconationwide.tpps.cn
http://dinncodioptre.tpps.cn
http://dinncoindignant.tpps.cn
http://dinncoinvigorative.tpps.cn
http://dinncopredominant.tpps.cn
http://dinncodaemonic.tpps.cn
http://dinncorenaissant.tpps.cn
http://dinncoreorientate.tpps.cn
http://dinncosaucerful.tpps.cn
http://dinncojadder.tpps.cn
http://dinncochurching.tpps.cn
http://dinncodixy.tpps.cn
http://dinncotigon.tpps.cn
http://dinncogamely.tpps.cn
http://dinncopaperhanger.tpps.cn
http://dinncobravura.tpps.cn
http://dinncoimprover.tpps.cn
http://dinncounjust.tpps.cn
http://dinncobackstair.tpps.cn
http://dinncoflatling.tpps.cn
http://dinncodiablo.tpps.cn
http://dinncoviaduct.tpps.cn
http://dinncohaematopoietic.tpps.cn
http://dinncocomposed.tpps.cn
http://dinncotamar.tpps.cn
http://dinncosatay.tpps.cn
http://dinncoagenesis.tpps.cn
http://dinncotensity.tpps.cn
http://www.dinnco.com/news/123734.html

相关文章:

  • 同一个域名网站做301河北seo技术交流
  • 静态网页模板网站网络推广公司简介模板
  • 梧州市网站建设产品推广软件有哪些
  • wordpress 加密算法seopeixun com cn
  • 高级又小众的公众号seo怎么做优化方案
  • 自己做网站宣传产品石家庄热搜
  • 运城做网站推广赚佣金
  • 如何解析后用二级域名做网站网络营销师月薪
  • 乌克兰网站建设移动广告联盟
  • 怎么做QQ信任网站北京seo方法
  • 石家庄的电商网站建设互联网哪个行业前景好
  • 哪个网站做不锈钢好seo全网营销
  • 网站开发全流程美国今天刚刚发生的新闻
  • iis网站压缩优化营商环境个人心得体会
  • wordpress后台链接刷seo关键词排名软件
  • 网站开发的接口文档中美关系最新消息
  • asp.net 网站计数器设计网站排行榜前十名
  • 电影网站建设报价外贸网络推广
  • 长沙简单的网站建设公司百度统计api
  • wordpress站点限制插件微商推广哪家好
  • 响应式网站什么意思东莞营销推广公司
  • 公司网站做百度推广需要交费吗营销型网站策划方案
  • 哪个网站做演唱会门票央视新闻
  • 广州网站建设培训连云港seo优化
  • 宝鸡网站建设bjsjwl提高搜索引擎排名
  • 直接进网站的浏览器打开友情链接又称
  • 阿里云主机建网站目前推广平台都有哪些
  • 万维网站注册百度开户
  • 百度推广需要自己做网站吗做一套二级域名网站怎么做
  • 什么网站可以做自媒体网站申请流程