网站首页 站内搜索

搜索结果

查询Tags标签: lst,共有 188条记录
  • 周期性曲线滤波算法

    using System.IO; using System;using System.Collections.Generic;using System.Linq; static public int SampleRate = 2000;//单位值HZ struct myData { public int x; //峰的X值 public double y; //峰的Y值 } pr…

    2022/3/8 20:14:43 人评论 次浏览
  • Python-常见异常类型

    1、ZeroDivisionError:除(或取模)零(所有数据类型) 2、IndexError:序列中没有该索引(index) 3、KeyError:映射中没有该键 4、NameError:未声明/初始化对象(没有属性) 5、SyntaxError:Python语法错误 6、ValueError:传入的参数无效1 # print(10/0) ZeroDivis…

    2022/2/26 17:51:44 人评论 次浏览
  • 求一个整数的因数分解--Java--小白必懂

    public class OJ_1415 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int num = sc.nextInt();int sNum = num;splitNum(sNum);}// 求整数的因式分解的方法public static void splitNum(int num) {if (num == 1) {System.out.println(nu…

    2022/2/25 1:31:42 人评论 次浏览
  • Python语法基础

    文章目录 1_序列list、tuple、str的通用操作2_ list与tuple的常用操作3_str的常用操作与正则表达式1_序列list、tuple、str的通用操作 #判断某值是否在序列中,在则返回True,否则返回Falselst = [-0.5,-2,3.5,4,(good)] a,b = -2,(good) print(a in lst) print(b in lst…

    2022/2/24 1:21:27 人评论 次浏览
  • Python-列表元素的修改操作

    列表元素的修改操作: 为指定索引的元素赋予一个新值 为指定的切片赋予一个新值1 lst = [10, 20, 30, 40] 2 # 一次修改一个值 3 lst[1] = 200 4 print(lst) 5 lst[1:3] = [200, 300, 400, 500, 600] 6 print(lst)

    2022/2/23 17:51:35 人评论 次浏览
  • Python random模块

    random常用模块讲解 # !/usr/bin/env python # -*- coding:utf-8 -*-import random# 大于0小于1的 随机小数 print(random.random())# 指定区间的 随机小数 print(random.uniform(2, 7))# 指定区间的随机整数,包含区间两端的整数 print(random.randint(3, 17))# 指定区间…

    2022/2/23 1:22:07 人评论 次浏览
  • 30段极简Python代码,30秒学一个实用技巧

    人生苦短,快学Python! 学 Python 怎样才最快,当然是实战各种小项目,只有自己去想与写,才记得住规则。今天给大家分享的是 30 个极简任务,初学者可以尝试着自己实现;本文同样也是 30 段代码,Python 开发者也可以看看是不是有没想到的用法。Python 是机器学习最广泛…

    2022/2/21 11:26:55 人评论 次浏览
  • Lab06 of CS61A of UCB

    MutabilityWrite a function which takes in a list lst, an argument entry, and another argument elem. This function will check through each item in lst to see if it is equal to entry. Upon finding an item equal to entry, the function should modify the l…

    2022/2/21 6:27:54 人评论 次浏览
  • python高级编程总结

    Python中一切皆对象 一切皆对象得含义就是每一个都有自己得属性,每一个都有自己得继承关系,你看到没有继承得,其实它隐式继承了object或者type。关于type可以看看元类。是对象意味着它可以随时随地得使用,比如赋值给一个变量,添加到列表中,作为参数出传递,做返回值…

    2022/2/14 11:11:34 人评论 次浏览
  • python的split()函数后面的中括号

    split()返回的是一个列表,所以中括号是他的访问索引。把split()看成列表就好理解了lst = [‘a’, ‘b’ , ‘c’] lst[0] ‘a’lst[-1] ‘c’

    2022/2/9 22:44:13 人评论 次浏览
  • Python之模块、包、文件、异常、高阶函数

    目录 1.模块 2.包 3.文件 4.异常 5.高阶函数1.模块1.1 概念 Python模块(Module),是一个Python文件,以.py结尾,包含了Python对象定义和Python语句。模块能定义函数,类,变量,也能包含可执行的代码 1.2 导入模块 方式1: import 模块名 (as 别名) # 使用模块语法: 模块…

    2022/2/7 22:42:53 人评论 次浏览
  • Python-列表元素的添加操作

    1 # 在列表的末尾添加一个元素2 lst = [10, 20, 30]3 print(初始列表, lst, id(lst))4 lst.append(100)5 print(添加100之后, lst, id(lst))6 7 # 在列表的末尾添加至少一个元素8 lst2 = [hello, world]9 lst.append(lst2) #将lst2作为一个元素添加到列表末尾 10 print(添…

    2022/2/6 22:13:14 人评论 次浏览
  • Python-列表元素的判断and遍历

    1 # 判定指定元素在列表中是否存在2 print(p in python)3 print(p not in python)4 5 lst = [10, 20, python, hello]6 print(10 in lst)7 print(10 not in lst)8 print(100 in lst)9 print(100 not in lst) 10 11 #列表元素的遍历 12 for item in lst: 13 print(ite…

    2022/2/6 20:42:39 人评论 次浏览
  • Python-列表的查询

    一、获取列表中指定元素的索引 index(value),index(value, start, stop) 如果列表中存在N个相同元素,只返回相同元素中的第一个元素的索引 如果查询的元素在列表中不存在,则会抛出ValueError 还可以在指定的start和stop之间进行查找1 lst = [hello, world, 98, hello] …

    2022/2/6 20:42:33 人评论 次浏览
  • Python-列表特点and创建

    列表的特点 列表元素按有序排序 索引映射为一个数据 列表可以存储重复数据 任意数据类型混存 根据需要动态分配和回收内存1 a = 10 2 lst = [hello, world, 98] 3 print(id(lst)) 4 print(type(lst)) 5 print(lst) 列表的创建1 一、[] 2 lst1 = [hello, world, 98] 3 二:…

    2022/2/6 20:42:29 人评论 次浏览
扫一扫关注最新编程教程