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 15:30
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
Computers and Technology, 22.06.2019 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
Computers and Technology, 23.06.2019 10:20
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
Computers and Technology, 23.06.2019 11:30
In cell h5 enter a formula that will calculate the percentage of attendees that went to the altamonte springs job fair in 2018.
Answers: 1
I'm a beginner in a computer science 1 class. We're learning to code with python. I've been asked to...
Mathematics, 12.12.2019 22:31