美文网首页
Data Storage Basic

Data Storage Basic

作者: 彩虹金刚_Q | 来源:发表于2018-08-29 10:58 被阅读0次

    Today in office I learned some basic data type "List" &"Tuple" , "Dict" &“set" 

    List is easy to understand and we used a lot in Java and you can get List(-1) which is pretty interesting and I think we seldom use before

    And it is flexible you can put List in List and get a element by using List[0][2]

    There is no duplicated value in set

    In order to write a English dialog more smoothly I googled some English docs and find something more about List

    ** operator to calculate powers

    >>> 2**7 # 2 to the power of 7   which is 128

    https://docs.python.org/3/tutorial/introduction.html#lists

    We can also do some calculation and let the game start

    a,b = 0,1

    while a <20 :

    print ('a=', a)

    a,b = b, a+b

    print(' b=' , b)

    end can be used to avoid the newline after the output

    so we can change it to print('b=' , b, end=';')

    after that we can define a function and put everything above in it 

    def cauculate(a,b) : 

    There are many argument values you can put in the function

    相关文章

      网友评论

          本文标题:Data Storage Basic

          本文链接:https://www.haomeiwen.com/subject/fbhhwftx.html