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

    1. ''' '''the comment in the middle will be shown in your code while ranning

    2. a=b
    c=a%b
    or we can simplify them into:a, c=b, a%b

    3. while we wanna test your code in another file, we need to (1) import + file_name  (2) file_name.function_name( your input)

    or we can do (1) from file_name import function_name  (2) function_name( your input )

    4. testmod() will import what inside ''' ''' as input and see is the output is same what is inside ''' ''' as well, like final exam

    5. when we are 调用function, we can add a * in the front of the function when the output appears with pairs, as so we can remove the pears
    def f():
      return (2,4,5)
    def f(a,b,c):
      return 2*a+b+c
      return g(*f())

    6. (0,0)*2=(0,0,0,0)
    ((0,0))*2=((0,0),(0,0))

    7. format: for example, we got x=90

    f'{x: 8b}'  means we will use empty to make it occupy 8 spaces in total

    f'{5:08b}' means we will use 0 to do that

    8. x%10 can get the right most number
    x //10%10 can get the second one from right side
    x//100%10 the third one

  • 相关阅读:
    Caesar cipher
    遗传算法之背包问题
    Transport scheme NOT recognized: [stomp]
    error running git
    Canvas 旋转的图片
    canvas时钟
    火箭起飞
    让图标转起来
    Tomcat启动脚本
    Task中的异常处理
  • 原文地址:https://www.cnblogs.com/eleni/p/11057031.html
Copyright © 2011-2022 走看看