Question

Using Python, write an application that tests an elementary school student on their basic math skill....

Using Python, write an application that tests an elementary school student on their basic math skill. The program should generate random equations to be solved with numbers between 0 and 12. The student should be told if they are correct or incorrect. If the user enters the word DONE, the program should end by telling the student their average (i.e. if they correctly answer 4 out of 8 problems, their average would be 50%).

To help modularize you code, create the following functions:

  • a function that randomly generates 2 integers between 0 and 12 and also generates a random number between 1 and 4 that is used to determine the operator (+, -, *, /). The function should ask the question "How much is 2*4?". The function should return the answer (i.e. the solution to the problem asked).
  • a function that accepts as parameter 2 values and displays the % correct to the student. This function returns nothing.

For evaluation, submit to Blackboard code that adheres to our Python standards.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PROGRAM SOLUTION:

import random
def equation():
correct=0
num1=random.choice(range(0,13)) #chooses num1
num2=random.choice(range(0,13)) #chooses num2
op_val=random.choice(range(1,5)) #chooses randomly operator value
if(op_val==1): #sets the operator
op='+'
elif(op_val==2):
op='-'
elif(op_val==3):
op='*'
elif(op_val==4):
op='/'
ans=0
print("How much is",str(num1),op,str(num2)+" ?",end="")
entered_ans=int(input()) #asks user for the answer for the equation
if(op=='+'):
ans=num1+num2
elif(op=='-'):
ans=num1-num2
elif(op=='*'):
ans=num1*num2
elif(op=='/'):
ans=num1/num2
if(ans==entered_ans): #if correct ans assigns 1
correct=1
print("Correct!")
else:
print("Incorrect!")
return correct #returns 0 or 1
  
def percent(total,correct):
return (correct/total)*100 #returns percent

if __name__=="__main__":
string=""
total=0
correct=0
while(string!="DONE"):
total=total+1
correct=correct+equation()
string=input("If your done enter DONE:")
avg=percent(total,correct)
print("You Scored",avg,"%")

#if any errors with indentation please verify it with the below Screenshots
  
PROGRAM SCREENSHOT:

POGRAM OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Using Python, write an application that tests an elementary school student on their basic math skill....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Programming in C: Write a program that will help an elementary school student learn multiplication. Use...

    Programming in C: Write a program that will help an elementary school student learn multiplication. Use the random number generator to produce two positive integers between 1 and 12 inclusive. It should then type a question such as:             How much is 6 times 7? The student then types the answer. Your program checks the students’ answer. If it is correct, print a message such as Very good!   If the answer is wrong, print a message such as No. Please...

  • Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random...

    Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random method to produce two positive one-digit integers. The program should then prompt the user with a question using random numbers, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display the message "Very good!" and ask whether the student wants to continue if so then ask another multiplication...

  • Create a variable named my_student_ID and assign YOUR STUDENT ID to it. Write a program that...

    Create a variable named my_student_ID and assign YOUR STUDENT ID to it. Write a program that generates a random integer between 1 and 10, inclusive; then displays the generated random integer and digits in my_student_ID that are less then or equal to the generated integer as a list. For example, if your student id is 45755245642 and the computer generates 4, then your program should display the below message random integer is 4 list of integer that are less than...

  • USING A PYTHON Write a program that gives simple math quizzes. The program should display two...

    USING A PYTHON Write a program that gives simple math quizzes. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  • Using Java IDE: Write an application that asks elementary students a set of 10 math problems...

    Using Java IDE: Write an application that asks elementary students a set of 10 math problems ● First ask the user for a level and a problem type. ● You need to validate the level and problem type and loop until the user enters a correct one. ● There should be 3 levels. Level 1 operands would have values in the range of 0-9, level 2 operands would have values in the range of 0-99, and level 3 operands would...

  • Python Code Write a program using functions and mainline logic which prompts the user to enter...

    Python Code Write a program using functions and mainline logic which prompts the user to enter a number. The number must be at least 5 and at most 20. (In other words, between 5 and 20, inclusive.) The program then generates that number of random integers and stores them in a list. The random integers should range from 0 to 100. (You can use a wider range if you want, but the lower end of the range must be at...

  • Can you help me write a Python 3.7 code for this question? Write a program using...

    Can you help me write a Python 3.7 code for this question? Write a program using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a list. It should then display the following data to back to the user: The list of integers The lowest number in the list The highest number in the list The total sum of all the numbers in the list The...

  • Python Object oriented programming Exercise 3 Dictionary Computers are playing an increasing role in education. Write...

    Python Object oriented programming Exercise 3 Dictionary Computers are playing an increasing role in education. Write a program that will help an elementary school student to learn English. To simplify the model, the program will first teach numbers from 1 to 10, colors and fruits. It will use a dictionary to store the pairs Spanish-English words. dataTable-uno':one,'dos':'two....' rojo':'red','blue':'Azul... manzana': apple, nara nja:orange. When running your program, it should get a random Spanish word from the dictionary dataTable and then show...

  • please write in python Write a program that asks for beginning and ending number. The program...

    please write in python Write a program that asks for beginning and ending number. The program generates a set of 20 random numbers between the numbers and displays a count of each number generated. Sample output Enter starting and ending number separated by comma: 5, 25 5 occurs 2 times 7 occurs 1 time 8 occurs 1 time 10 occurs 2 times 12 occurs 1 time 13 occurs 2 time 15 occurs 5 times 16 occurs 1 time 20 occurs...

  • Design a program using Python and using from flask Import flask that generates a lottery number...

    Design a program using Python and using from flask Import flask that generates a lottery number but in a website.. The program should have an Integer array with 9 elements. Write a loop that steps through the array, randomly generating a number in the range of 0 through 42 for each element. (Use the random function) Then write another loop that displays the contents of the array. Each number should be displayed as a list, the numbers should be generated...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT