1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
message = " hello \"'world'\" "
author = "\n\tzibu "
print((message + author).strip())
print(10 ** 6)
guestList = ['a', 'b', 'c', 'd'] guestList.append('e') del guestList[0] guestList[0] = "b+" guestList.remove("c") print(guestList.pop(0), "剩下的数组元素", guestList)
guestList.sort()
guestList.sort(reverse=True)
sorted(guestList)
guestList.reverse()
len(guestList)
for guest in guestList: print(guest + "\t") print("py没有分号和花括号,通过缩进判断for循环结束")
for value in range(1, 5): print(str(value) + "\t")
even_numbers = list(range(2, 11, 2)) print(even_numbers)
print(min(even_numbers)) print(max(even_numbers)) print(sum(even_numbers))
squares = [value ** 2 for value in range(1, 10)] print(squares)
nameList = ['zibu', 'tom', 'jack', 'lucy', 'fancy', 'shelton']
print(nameList[0:3])
print(nameList[:3])
print(nameList[1:])
print(nameList[-3:])
print(nameList[:])
newNameList = nameList[:]
dimensions = (200, 50) dimensions = (400, 100)
print(dimensions)
print("zibu" in nameList)
alien_0 = {"color": "green", "point": 5} alien_0["height"] = 10 print(alien_0["height"]) del alien_0["height"]
for key, value in alien_0.items(): print(key) print(value)
for key in alien_0.keys(): print(key)
for value in alien_0.values(): print(value)
for value in set(alien_0.values()): print(value)
def greet_user(name="zibu", *extraParam): print("hello " + name) if len(extraParam)>1: print(extraParam)
greet_user(input("hey ,body give me your name"))
greet_user()
greet_user("zibu", 1, 2, 3, 4, 5)
int("20") str(20)
|