Day 02 2018-03-12

2018-03-13  本文已影响0人  刘洋_2ac6

Function

def f(x):

no return will return None

Tuples元组

conveniently used to swap variable values: (x, y) = (y, x)

def f(x, y)
  a = x // y      //integer division
  b = x % y
return (a , b)

List

total = 0
for i in L:
  total +=i
print total

add elements: L.append(element)
convert string to list: list(s)
s.split('<')
''.join(L) to turn a list of characters into a string

colone a list: chill = cool[:]

上一篇 下一篇

猜你喜欢

热点阅读