zoukankan      html  css  js  c++  java
  • COMP9021--6.24

    1. from timeit import timeit计算程序运行时间

    比如: timeit(list(range(1000)))

    2. if we using jupyter it will keep ranning for many times and giving the average time, also we want the output as a string, so add number= after the'' so we can know hou many characters we want as output

    3. the function remove will cost more time, cause every other character need to change their position, so the time will cost the most if it is the first one in the list

    4. 图像

    from matplolib import pyplots or import matplolib.pyplot as plt

    plt.plot([x轴坐标][y轴坐标]) will get the chart

    otherwise using zip:

    points=[(),(),(),(),()]
    zip(point)
    which is a generator so we need to write it into: list(zip(*points)), will get the same result with ([x][y])

    5. zip 中如果缺少了一个相对应的,如(x,y,z), (1,2), (5,6,7), 则以最短的两位的情况为主

    6. hash(number): when this number become big enough, or it is actually a tuple, those number will be changed due to a particular hash code, the hash code will be different

    7. setup = 

    to do something before timming, so this step could be treated  as start point and steps before do not need to be timming

    8. pop from the beginning need to spend a long time. Remove take a long time as well, which need to find the key and delete it, also every other charcter need to change the position, so as a sequence, searching the position is more importance in speed

    9. set will cost more time

    10. the changes you made will only saved in this function, otherwise we can use global, like global a, which means what we did about a will be saw in other functions as well
    a=10
    def g():
       print(a)
       a=20
       print(a)
    g()
    a

    which is not working cause the first a is global, but after turned it into 20 , it is a local, pyton get confused so it did not work. So it need to be global or local, can not be both at the same time. So to solve this, we can get a new character and make it have the same value with what we want

  • 相关阅读:
    net.sf.json.JSONException: There is a cycle in the hierarchy!
    数据源的配置
    java枚举使用详解
    hibernate级联保存,更新个人遇到的问题
    NonUniqueObjectException 问题
    No.2 dotnetcore&docker--数据库等在Docker上的配置
    No.1 dotnetcore&docker--环境搭建
    No.5 dotnetcore&docker--采用Ambry做文件服务器
    No.3 dotnetcore&docker--搭建一个nuget服务器
    关于APM数据采集实例以及Eureka整合的一个想法
  • 原文地址:https://www.cnblogs.com/eleni/p/11096239.html
Copyright © 2011-2022 走看看