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 = Dice() print(dice.roll())
##pypi.org 网站找其他功能的包
找到引入命令行(pip install openpyxl)
自动安装了openpyxl这个包
import random class Dice: def roll(self): x = random.randint(1,6) y = random.randint(1,6) return x,y#python会自动默认为一个元组 dice = Dice() print(dice.roll())
##pypi.org 网站找其他功能的包
找到引入命令行(pip install openpyxl)
自动安装了openpyxl这个包