摘要:
1.机器学习步骤(254:45) (1)import the data - csv文件 (2)clean the data - 删除重复、不完整数据等 (3)split the data into training/ test sets (4)create a model - 决策树、神经网络等 ( 阅读全文
摘要:
1.用python内置包生成1-6 的随机数元组 import random class Dice: def roll(self): x = random.randint(1,6) y = random.randint(1,6) return x,y#python会自动默认为一个元组 dice = 阅读全文
摘要:
1.try except 语句(179:22) 避免因一些错误导致的程序崩溃 try: age = int (input("Age: ")) income = 20000 risk = income / age print(age) except ZeroDivisionError: print(' 阅读全文
摘要:
1.用双层循环语句输出一个F numbers = [5,2,5,2,2] for item in numbers: output = '' for count in range(item): output += "x" print(output) 2.寻找列表中最大的数 numbers = [3,6 阅读全文