高分和保持得分
#这是一个用于循环的循环,可以使玩家玩谜语游戏的得分 #它运行并循环,但无法正确计算得分。 #有6个谜语和3轮。 #say我得到4/6正确的分数是20,但它显示为3.0。导入数学功能时,如何获得精确的答案?
for i in range(6):
print(riddles[i])
#
userchoice = input("Enter A, B, C, or D: ")
if userchoice.upper() == answers[i]:
print("That's Correct")
score += 5
print(f" {score}")
else:
print("That's Incorrect")
score -= 1
print(f"{score}")
total = total + int(score)
highScoreEasy = print(f"Here is your score: {int(total/score)} !!!!!")
print()
#This is a for loop to get the score of a player playing a riddle game
#It runs and loops but it's not calculating the score properly. #There're 6 riddles and 3 rounds. #Say I get 4/6 correct my score is 20 but it's displaying 3.0 instead. how do I get a precise answer while importing the math function?
for i in range(6):
print(riddles[i])
#
userchoice = input("Enter A, B, C, or D: ")
if userchoice.upper() == answers[i]:
print("That's Correct")
score += 5
print(f" {score}")
else:
print("That's Incorrect")
score -= 1
print(f"{score}")
total = total + int(score)
highScoreEasy = print(f"Here is your score: {int(total/score)} !!!!!")
print()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不应该只是简单的总和吗?
Shouldn't it just be a simple sum?