Python迷你测验的分数和评分系统

问题描述

因此,我正在测试一个迷你测验代码,但我希望它能够将用户正确和不正确的问题分数(满分5分)保持在5分之内,同时在末尾加总得分以得出“成绩” ”。代码非常简单,因为我才刚刚起步,但是我完全不知道该怎么做。这是我到目前为止的一切!

def q1(in1,in2):
  print('What is',in1,'%',in2)
  input()
  if input == in1%in2:
    return 2

def q2(in1,'*',in2)
  input()
  if input == in1*in2:
    return 1
    
def q3(in1,'/',in2)
  input()
  if input == in1/in2:
    return 2

def q4(in1,'**',in2)
  input()
  if input == in1**in2:
    return 2

def q5(in1,in2,in3,in4):
  print('What is','-','+',in4)
  input()
  if input == in1-in2*in3+in4:
    return 3

import random
in1 = random.randint(-10,10)
in2 = random.randint(-10,10)
in3 = random.randint(-10,10)
in4 = random.randint(-10,10)
  


print('Hello,what is your name?')
name = input()

# This part of the script determine whether or not the user is going to take the quiz or not

print(name,'Would you like to take this quiz? Please type y for yes and n for no')
yesno = input()
if yesno == 'y' :
  print('Great,Here are the questions!')
else:
  exit()


q1(in1,in2)
q2(in1,in2)
q3(in3,in4)
q4(in3,in4)
q5(in1,in4)
#Print score/grade/correct and wrong after here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)