![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 17.10.2020 07:01 helpmeplz33
I'm a beginner in a computer science 1 class. We're learning to code with python. I've been asked to develop code for a simple math quiz. However, my code will no run and I receive the RESTART but no further output. Please advise.
import random
def add(num1, num2):
total_correct = 0
for I in range(2):
num1 = random. randint(1,20)
num2 = random. randint(1,20)
print(num1, "+", num2, '=', end = "")
answer = int(input())
if answer == (num1 + num2):
print("correct")
total_correct+=1
else:
print("incorrect")
return total_correct
def sub(num1, num2):
total_correct = 0
for I in range(2):
num1 = random. randint(1,20)
num2 = random. randint(1,20)
print(num1, "-", num2, "=", end = "")
answer = int(input())
if answer == (num1 - num2):
print("correct")
total_correct+=1
else:
print("incorrect")
return total_correct
def mult(num1, num2):
total_correct = 0
for I in range(2):
num1 = random. randint(1, 20)
num2 = random. randint(1,20)
print(num1, "*", num2, "=", end = "")
answer = int(input())
if answer == (num1*num2):
print("correct")
else:
print("incorrect")
return total_correct
def div(num1, num2):
total_correct = 0
for I in range(2):
num1 = random. randint(1,20)
num2 = random. randint(1,20)
print(num1, "//", num2, "=", end = "")
answer = int(input())
if answer == (num1//num2):
print("correct")
total_correct+=1
else:
print("incorrect")
return total_correct
def mod(num1,num2):
total_correct = 0
for I in range(2):
num1 = random. randint(1,20)
num2 = random. randint(1,20)
print(num1, "%", num2, "=", end = "")
answer = int(input())
if answer == (num1%num2):
print("correct")
else:
print("incorrect")
return total_correct
again = input()
while again == "yes":
correct_answers=0
correct_answers += add() + sub() + mult() + div() + mod()
print("You've completed the quiz, with a score of", correct_answers, "would you like to try again?", "Type yes to take the quiz again")
again = input()
![ansver](/tpl/images/cats/User.png)
Answers: 2
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 22:40, shaylawaldo11
Write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard). required: debug the disassembly code and note down the address and memory information.
Answers: 3
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 11:00, dirttrackr75
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
You know the right answer?
I'm a beginner in a computer science 1 class. We're learning to code with python. I've been asked to...
Questions in other subjects:
![Konu](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 02:07
![Konu](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 02:07
![Konu](/tpl/images/cats/en.png)
English, 07.05.2020 02:07
![Konu](/tpl/images/cats/en.png)
![Konu](/tpl/images/cats/fizika.png)
![Konu](/tpl/images/cats/health.png)
Medicine, 07.05.2020 02:07
![Konu](/tpl/images/cats/ekonomika.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 02:07
![Konu](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 02:07