def problem(area=10): # 随机生成一道题目(自然数四则运算或分数运算),运算符不超过3个 try: if random.choice([1, 2]) == 1: # 随机生成 自然数或分数 的四则运算 expression, print_expression = natural ...
分类:
其他好文 时间:
2020-12-04 10:58:33
阅读次数:
8
#运行代码: import random 四则运算 def t(): sym = ['+', '-', '×', '÷'] f= random.randint(0, 3) n1 = random.randint(1, 20) n2 = random.randint(1, 20) result = 0 ...
分类:
其他好文 时间:
2020-12-04 10:51:23
阅读次数:
6
import randomimport mathimport fractionsq=[]ans=[]def c1(q,ans) symble = random.choice(['+','-','*','/']) if symble == '+': n1 = random.randint(0,20) ...
分类:
其他好文 时间:
2020-12-04 10:49:38
阅读次数:
6
1 import random#导入随机库 2 from fractions import Fraction#导入分数运算 3 ##整数运算 4 def c1(q, ans): 5 operator = random.choice(['+', '-', '*', '/']) # 生成运算符 6 if ...
分类:
其他好文 时间:
2020-12-03 12:26:32
阅读次数:
16
代码如下: import random #四则运算 def t(): sym = ['+', '-', '×', '÷'] f= random.randint(0, 3) n1 = random.randint(1, 20) n2 = random.randint(1, 20) result = 0 ...
分类:
其他好文 时间:
2020-12-03 12:25:51
阅读次数:
10
##运行截图如下 ##参考代码如下 import random #四则运算 def t(): sym = ['+', '-', '×', '÷'] f= random.randint(0, 3) n1 = random.randint(1, 20) n2 = random.randint(1, 20 ...
分类:
其他好文 时间:
2020-12-03 12:24:39
阅读次数:
11
四则运算 1 import random#确保随机取数 2 from fractions import Fraction#确保能使用分数表示真分数 3 4 5 ##两个整数的四则运算 6 def c1(q, ans): 7 symbol = random.choice(['+', '-', '*', ...
分类:
其他好文 时间:
2020-12-03 12:20:32
阅读次数:
6
import random from fractions import Fraction def newint(): opr = ['+', '-', '×', '÷'] fh = random.randint(0, 3) n1 = random.randint(1, 20) n2 = random ...
分类:
其他好文 时间:
2020-12-03 12:18:42
阅读次数:
6
代码链接:https://gitee.com/cx20201316/text/blob/master/sizeyunsuan.py 不足:不知道怎么查重复并输出重复的题 ...
分类:
其他好文 时间:
2020-12-03 12:10:37
阅读次数:
6
切换盘符目录 cd /d d: # 切换到D盘 cd /d d:\Packages # 切换到Packages目录 cls # (clear screen)清除屏幕 ipconfig # 查看IP地址 calc # (calculator)计算器 mspaint # 画图 notepad # 记事本 ...
分类:
其他好文 时间:
2020-12-02 12:23:47
阅读次数:
6