码迷,mamicode.com
首页 >  
搜索关键字:numbers range    ( 16974个结果
4.27 每日小三练
1:Python range 函数 语法:range(start, stop[, step]) start: 计数从 start 开始。默认是从 0 开始。例如range(5)等价于range(0, 5); stop: 计数到 stop 结束,但不包括 stop。例如:range(0, 5) 是[0 ...
分类:其他好文   时间:2020-04-28 00:31:21    阅读次数:47
【2020Python修炼记】python并发编程(七)协程
一、什么是协程 引例: import time # 串行执行计算密集型的任务 1.2372429370880127 def func1(): for i in range(10000000): i + 1 def func2(): for i in range(10000000): i + 1 st ...
分类:编程语言   时间:2020-04-27 22:58:01    阅读次数:99
python基础语法4
python基础语法4 分支语句 基本形式 If ………: elif ………: elif ………: else ………: 且——或关系 在A和B条件下 If A and B: If A or B: 特殊用法(连续判断) X = 22 if 20 20 for i in range(6): i += 3 ...
分类:编程语言   时间:2020-04-27 22:39:00    阅读次数:71
For循环套用示例
99乘法表 1 for i in range(1,10): 2 3 for j in range(1,i+1): 4 5 print("%s*%s=%s " %(j,i,j*i),end="") 6 7 print() 输出结果: 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3= ...
分类:其他好文   时间:2020-04-27 17:09:50    阅读次数:70
《python》join、守护进程、锁/信号量/事件、进程队列
一、multiprocess.process模块 1、join方法 阻塞主进程,等待子进程执行完毕再放开阻塞 import time import random from multiprocessing import Process # 单个子进程 def func(index): time.sle ...
分类:编程语言   时间:2020-04-27 16:58:55    阅读次数:59
leetcode 每日一题 15. 三数之和
双指针法 思路: 首先对原数组进行排序,然后从头开始遍历,当遇到nums[i]>0时终止。在遍历过程中,对遍历元素i后面剩余子数组首尾添加指针L和R,通过移动LR找到满足题设条件的[i,L,R]。这里要注意的是,为了避免重复的情况,在遍历过程中,如果遍历的元素nums[i]和它之前元素nums[i- ...
分类:其他好文   时间:2020-04-27 13:21:53    阅读次数:56
python的高阶特性
列表生成式(列表解析) 效率比普通方法高a=[x for x in range(100)if x % 2 == 0] x:列表元素的值for x in range(100):数据来源if x%2==0:元素的成立条件 例:生成一个二维列表a=[[0 for i in range(10)]for j ...
分类:编程语言   时间:2020-04-27 11:36:21    阅读次数:71
PTA(Advanced Level)1060.Are They Equal
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×105 with ...
分类:其他好文   时间:2020-04-27 11:23:14    阅读次数:43
[LeetCode in Python] 5393 (M) maximum points you can obtain from cards 可获得的最大点数
题目 https://leetcode cn.com/problems/maximum points you can obtain from cards/ 几张卡牌 排成一行,每张卡牌都有一个对应的点数。点数由整数数组 cardPoints 给出。 每次行动,你可以从行的开头或者末尾拿一张卡牌,最终 ...
分类:编程语言   时间:2020-04-26 22:33:15    阅读次数:89
Python 梯度下降实现逻辑回归
import numpy as np import pandas as pd import matplotlib.pyplot as plt import os path = 'data'+os.sep+'LogiReg_data.txt' pdData = pd.read_csv(path,hea ...
分类:编程语言   时间:2020-04-26 18:38:31    阅读次数:77
16974条   上一页 1 ... 95 96 97 98 99 ... 1698 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!