摘要: #-*-coding:utf-8-*- ''' 实现一个加法计数器 如5+7+9,进行分割再进行计算,将结果存入字典中dic = {"":"} ''' dic = {} content = input("请输入内容:").strip() content_list = content.split('+') #print(content_list) sum = 0 for i in cont... 阅读全文
posted @ 2019-01-06 23:17 sunnybowen 阅读(784) 评论(0) 推荐(0) 编辑
摘要: #-*-coding:utf-8-*- ''' 统计用户输入内容,索引为奇数,并且对于的索引的是数字的个数 ''' count = 0 content = input(">>>") for i in range(len(content)): if i%2 == 1 and content[i].isdigit(): content +=1 print(count) ... 阅读全文
posted @ 2019-01-06 23:16 sunnybowen 阅读(609) 评论(0) 推荐(0) 编辑
摘要: #-*-coding:utf-8-*- ''' 从100打印到0 ''' for i in range(100,-1,-1): print(i) 阅读全文
posted @ 2019-01-06 23:15 sunnybowen 阅读(705) 评论(0) 推荐(0) 编辑
摘要: #-*-coding:utf-8-*- ''' join()方法,注意列表元素要是str类型的,不能是int,否则会报错 ''' lis = ['q','qw','1'] s = '*'.join(lis) print(s) 阅读全文
posted @ 2019-01-06 22:01 sunnybowen 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 无参函数 2 无返回值的情况 3 一个返回值 4 返回多个返回值 5 解包 6 带参数的函数 7 函数调用 阅读全文
posted @ 2019-01-06 16:38 sunnybowen 阅读(170) 评论(0) 推荐(0) 编辑