• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






Apollo

 
 

Powered by 博客园
| | 新随笔 | | | 管理
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 53 下一页

2018年12月30日

Python列表反转操作
摘要: # 列表反转1 a = [99, 66, 25, 10, 3] a.reverse() print(a) # 列表反转2 a = [99, 66, 25, 10, 3] print(a[::-1]) # 列表反转3 a = [145, 130, 120, 99, 66, 25, 10, 3] N = len(a) for i in range(len(a) // 2): a[i]... 阅读全文
posted @ 2018-12-30 12:54 阿波罗Apollo 阅读(295) 评论(0) 推荐(0)
 
Python join()逗号分割列表
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- lst = [1,2,3,4,5] str = '-'.join(str(n) for n in lst) print(str) 阅读全文
posted @ 2018-12-30 12:50 阿波罗Apollo 阅读(658) 评论(0) 推荐(0)
 
Python基础函数调用
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- def func1(): print('hello world !') def func2(): for i in range(3): func1() if __name__ == '__main__': func2() 阅读全文
posted @ 2018-12-30 12:45 阿波罗Apollo 阅读(242) 评论(0) 推荐(0)
 
Python设置文本文字颜色
摘要: 提示:此时文字颜色为pink提示:此时文字颜色为blue提示:此时文字颜色为green提示:此时文字颜色为yellow提示:此时文字颜色为red提示:此时文字颜色为black提示:此时文字颜色为black+underline提示:此时文字颜色为black+bold 阅读全文
posted @ 2018-12-30 12:40 阿波罗Apollo 阅读(2434) 评论(0) 推荐(1)
 
Python函数名挂载变量
摘要: def func(x,y): mysum = x+y return mysum func.name = 'apollo' print(func.name) # apollo # print(func.age) # 不挂载,获取会报错 # AttributeError: 'function' object has no attribute 'age' 阅读全文
posted @ 2018-12-30 12:26 阿波罗Apollo 阅读(107) 评论(0) 推荐(0)
 
python输出指定区间范围内的素数
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- # 输出指定范围内的素数 lower = int(input("请您输入区间最小值: ")) upper = int(input("请您输入区间最大值: ")) lst = [] for num in range(lower,upper + 1): # 素数大于 1 if num > 1:... 阅读全文
posted @ 2018-12-30 12:21 阿波罗Apollo 阅读(3427) 评论(0) 推荐(0)
 
python对数组插入排序
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- lst = [5,1,4,3,2] for i in range(len(lst) - 1): for j in range(i + 1, len(lst)): if lst[i] > lst[j]: lst[i], lst[j] = lst[j], lst... 阅读全文
posted @ 2018-12-30 12:10 阿波罗Apollo 阅读(303) 评论(0) 推荐(0)
 
Python求3*3矩阵对角线元素之和
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- """ # 3*3矩阵对角线元素之和 1 2 3 4 5 6 7 8 9 # array = [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]] """###########################... 阅读全文
posted @ 2018-12-30 11:33 阿波罗Apollo 阅读(7237) 评论(0) 推荐(0)
 
Python数组插入排序
摘要: # Python数组插入排序 a = [1, 4, 6, 9, 13] number = int(input("insert a new number:\n")) end = a[len(a) - 1] if number > end: a.append(number) else: for i in range(len(a)): if a[i] > number:... 阅读全文
posted @ 2018-12-30 11:11 阿波罗Apollo 阅读(346) 评论(0) 推荐(0)
 

2018年12月28日

js面向对象
摘要: // 面向对象// 1. 添加属性// 通过this关键字,绑定属性,并且指定他的值。// 原型链// 2. 添加方法// 在Banner.prototype上绑定方法就可以了。// function Banner() {// // 这个里面写的代码// // 相当于是Python中的__init_ 阅读全文
posted @ 2018-12-28 21:56 阿波罗Apollo 阅读(152) 评论(0) 推荐(0)
 
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 53 下一页