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()
Answers: 2
Computers and Technology, 22.06.2019 14:40
You are working with a professional edition organization. they wish to install the expense tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. if the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install expense tracker?
Answers: 1
Computers and Technology, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
Computers and Technology, 23.06.2019 07:00
Why is investing in a mutual fund less risky than investing in a particular company's stock? a. mutual funds only invest in blue-chip stocks. b. investments in mutual funds are more liquid. c. mutual funds hold a diversified portfolio of stocks. d. investments in mutual funds offer a higher rate of return.
Answers: 2
I'm a beginner in a computer science 1 class. We're learning to code with python. I've been asked to...
Mathematics, 04.08.2019 15:40
Physics, 04.08.2019 15:40
History, 04.08.2019 15:40
Biology, 04.08.2019 15:40
Social Studies, 04.08.2019 15:40
Biology, 04.08.2019 15:40
Biology, 04.08.2019 15:40
Biology, 04.08.2019 15:40
Biology, 04.08.2019 15:40
Social Studies, 04.08.2019 15:40
History, 04.08.2019 15:40
History, 04.08.2019 15:40
History, 04.08.2019 15:40
English, 04.08.2019 15:40
Mathematics, 04.08.2019 15:40
English, 04.08.2019 15:40