欢迎来到【idea 运行tomcat 源码】【dmi macd背离源码】【有品商城源码】python 口算 源码_python口算题代码-皮皮网网站!!!

皮皮网

【idea 运行tomcat 源码】【dmi macd背离源码】【有品商城源码】python 口算 源码_python口算题代码-皮皮网 扫描左侧二维码访问本站手机端

【idea 运行tomcat 源码】【dmi macd背离源码】【有品商城源码】python 口算 源码_python口算题代码

2024-11-30 02:42:37 来源:{typename type="name"/} 分类:{typename type="name"/}

1.编程口算题输答案后判断对错,口算口算Python编程语句怎么写?

python 口算 源码_python口算题代码

编程口算题输答案后判断对错,源码idea 运行tomcat 源码Python编程语句怎么写?

       import random

       flag = ["+",题代dmi macd背离源码"-","×","÷"]

       a1 = random.randint(0,9)

       a2 = random.randint(0,9)

       i_flag = random.randint(0,3)

       str = f"{ a1} { flag[i_flag]} { a2} = "

       result = None

       if flag[i_flag] == "+":

          result = a1 + a2

       elif flag[i_flag] == "-":

            result = a1 - a2

       elif flag[i_flag] == "×":

           result = a1 * a2

       elif flag[i_flag] == "÷":

           result = a1 / a2

       else:

           pass

       ins = input(str)

       if f"{ result}" == ins:

          print(f"{ ins} is correct! ")

       else:

          print(f"{ ins} is wrong, right answer is : { str}{ result}")