Question: ## Need a flowchart using raptor for this program. (Python) import random numberOfProblems = int(input('How many times do you want the for loop to run?'))
## Need a flowchart using raptor for this program. (Python)
import random
numberOfProblems = int(input('How many times do you want the for loop to run?')) # prompts user for number of math problems
for counter in range(numberOfProblems):
print(counter + 1, " Times through the loop!!!")
firstnum = random.randrange(1,11) # return an int from 1 to 100
secondnum = random.randrange(1, 11)
compsum = firstnum + secondnum # adds the 2 random numbers together
# print (compsum) # print for troubleshooting
print("What is the sum of", firstnum, " +", secondnum, "?") # presents problem to user
added = int(input("Your answer is: ")) # gets user input
if added == compsum: # compares user input to real answer
print("You are correct!!!")
else:
print ("Sorry, you are incorrect")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
