摘要: python challenge 2:迭代与列表http://www.pythonchallenge.com/pc/def/equality.html本关在网页源代码中给了数量巨大的乱码字符串,要求找出隐藏在里面出现次数很少的字符说起统计字符,那自然而然地想到使用python的字典dic>>> for c in s: if c.isalpha(): if d.has_key(c): d[c]+=1 else: d[c]=1 >>> for k in d: print k,d[k] e... 阅读全文
posted @ 2013-08-19 22:00 iyjhabc 阅读(254) 评论(0) 推荐(0) 编辑
摘要: python challenge 1:字符串处理图中给了三个字母的映射,都是把字母映射到ASSII码+2的字母上。http://www.pythonchallenge.com/pc/def/map.html>>> ns="">>> for c in s: if c.isalpha(): if(c>> ns"i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and 阅读全文
posted @ 2013-08-19 21:57 iyjhabc 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 0、2的38次方python的整数都是大数,不需担心超出32位的为题。对于求指数,python有专门的操作符**2**38274877906944L下面总结一下python的算术操作符:+ - * / != == >> a=3>>> b=a>>> id(a)10415448>>> id(b)10415448>>> a is bTrue内建函数print ‘abc’ #打印对象del list1 #删除对象绝对值abs(-3.5)3.5空值判断list1=[1,2,3]list2=[1,2,0]list3=[1, 阅读全文
posted @ 2013-08-19 21:20 iyjhabc 阅读(247) 评论(0) 推荐(0) 编辑