- 博客(7)
- 收藏
- 关注
原创 Python 统计字符个数
输入一行字符,分别统计出其中英文字母,数字,空格,其它字符的个数。 num = raw_input() num = list(num) n = 0 m = 0 v = 0 for i in num: if i == ' ': n += 1 if i.isdigit(): m += 1 if i.isalpha():
2016-05-08 12:36:46
3973
原创 两数之和
给定一个数组,找到两个数,使得他们的和为一个给定的数值target。 函数twoSum返回两个数字index1,index2, 其中:number[index1] + number[index2]==target; 注意:index1必须小于index2且不能为0假设每一组输入只有唯一的一组解。 格式:第一行输入一个数n,接下来的两行分别输入数组number[n]和targ
2016-05-08 12:12:37
545
转载 Python中list操作(转载自博客-一克棉花)
创建列表 sample_list = ['a',1,('a','b')] Python 列表操作 sample_list = ['a','b',0,1,3] 得到列表中的某一个值 value_start = sample_list[0] end_value = sample_list[-1] 删除列表的第一个值 del sample_list[0] 在列表中插入一
2016-05-07 15:27:15
384
原创 交叉排列
输入一行 k 个用空格分隔开的整数,依次为 n1, n2 … nk。请将所有下标不能被 3 但可以被 2 整除的数在这些数字原有的位置上进行升序排列,此外,将余下下标能被 3 整除的数在这些数字原有的位置上进行降序排列。 输出包括一行,与输入相对应的若干个整数,为排序后的结果,整数之间用空格分隔。 t = raw_input().split(' ') n =
2016-05-07 14:31:38
1131
原创 Python 简单斐波那契数列
n = int(raw_input()) first = 0 second = 1 f = [0] num = 0 while num first, second = second, first + second f.append(first) num += 1 print f[n]
2016-05-07 12:51:19
501
原创 Udacity:python基础
Programming Foundations with Python? 1. Learn how to find and use a class through the Internet(Google, flow_stack) 2. Use turtle to draw something interesting.(class) 3.Class, the blu
2016-05-05 22:28:11
554
原创 学习路径规划
Udacity: Python, Machine learning, Statistics Analyst. 算法,数据结构: leetcode 向学长学习经验,讲究效率。记住,效率为王,打心底里看不起那些装作很努力其实低效率的彩笔。
2016-05-05 22:24:25
1557
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅