Question: using python 3. given code: import math import random def primary_school_quiz(flag, n): # Your code for primary_school_quiz function goes here (instead of keyword pass) #

 using python 3. given code: import math import random def primary_school_quiz(flag,

using python 3.

given code:

import math import random

def primary_school_quiz(flag, n): # Your code for primary_school_quiz function goes here (instead of keyword pass) # Your code should include dosctrings and the body of the function pass

def high_school_eqsolver(a,b,c): # Your code for high_school_quiz function goes here (instead of keyword pass) # Your code should include dosctrings and the body of the function pass

# main

# your code for the welcome tmessage goes here

name=input("What is your name? ")

status=input("Hi "+name+". Are you in? Enter 1 for primary school 2 for high school or 3 for none of the above? ")

if status=='1': # your code goes here pass

elif status=='2':

# your code for welcome message flag=True while flag: question=input(name+", would you like a quadratic equation solved? ")

# your code to handle varous form of "yes" goes here

if question!="yes": flag=False else: print("Good choice!") # your code goes here (i.e ask for coefficients a,b and c and call) # then make a function call and pass to the fucntion # the three coefficients the pupil entered else: # your code goes here pass

print("Good bye "+name+"!")

1.1 The Core Functions Your solution in a2-part1.xxxxxx. py must have two functions called: primary_school_quiz and high_school_eqsolver You should design and test these functions first before moving onto the main part of the program. Here are specifications for the two functions: primary school_quiz: This function takes two parameters, namely an integer flag and a positive integer n. If flag is 0, primary_school_quiz helps practice subtraction. But if flag is 1, primary_schoolquiz helps practice exponentiation. The function, primary_school_quiz then generates n math problems that a pupil must answer in turn. For each question, it generates two random positive, single-digit numbers (check out python's random module to see if there's a useful function in there) and asks the pupil for the answer to the math problem with those two numbers (either subtract the second number from the first, or raise the first number to the power of the second number). primary_school_quiz then prompts the pupil for the answer, and checks if her answer is correct. At the end of n questions, performTest returns the number of questions answered correctly high_school_eqsolver: This function has three parameters representing three real numbers for the coefficients of the quadratic equation ar2 + br + c = 0 The function displays/prints the equation frist and then prints its solutions. The function must display correct and meaningful solutions given any three real numbers for coefficients a, b and c. See examples in Section 4 to understand what that means. Please consider the examples (and the video) to be a part of the function/program specifications that must be followed. Note that to solve this problem, you do not need to use Python's complex numbers. 1.2 The User Interaction i.e. the main part of the program Now that you have the two functions that perform the core functionality, you want to make it more user friendly for the pupils (after all, alas, the pupil may not know how to write code and call functions in Python she). In the main part of your program, write your code in specified places. You code must follow the behaviour indicated in the example runs in Section 4 (and the video to be provided) For example, for primary school pupils, called Ena, you will first ask her whether she would like to practice subtraction or exponentiation. Then ask her how many practice questions she'd like (if she says 0, then your code should not ask her to solve any math questions) Using her responses, call the primary_school_quiz function with the appropriate values. When returns the number of correct answers, display a message to the pupil . Ifshe did 90% or better, display on screen. Congratulations Ena! If she did 70% or better, but worse than 90%, display on screen: You did well Ena, but I know you can do If she did worse than 70%, display on screen: I think you need some more practice Ena. You'll probably get an A tomorrow. Now go eat your dinner and go to sleep. Good bye Ena! better. Good bve Ena! Good bye Ena

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!