Question: PYTHON ONLY!! A main program is provided in the template. The main program defines a question, an answer and the numberOfTries the user can guess

PYTHON ONLY!!

A main program is provided in the template. The main program defines a question, an answer and the numberOfTries the user can guess the answer before being presented with the answer. Write the following functions which will be called by the main program.

Write a function askQuestion(question,answer,numberOfTries).

This function has 3 parameters and should allow the user to answer the question until the answer is correct or they have reached the numberOfTries. The function should return True if the answer has been achieved or False if they user has exceeded the numberOfTries without answering correctly.

Another function result(verdict,answer) should print either "Correct" or "You have used your allotment of guesses. The correct answer is .." The main program is given in the template.

 PYTHON ONLY!! A main program is provided in the template. The

main.py Load default template.. 1 #write the function askQuestion here 2 def askouestion (question, answer, numberofTries): 4 #write the function result here 5 def result (g,ans): s def main): q"What is the name of the University? " a- "NKU" 10 12 grade askQuestion(q,a,n) 13 14 15 16 17 18 19 29 21 result (grade,a) problem"What is 53?" solution"" tries 2 grade askQuestion(problem,solution,tries) result(grade, solution) question"What is the language we are using?" 22 answer "Python" 23 g askQuestion(question, answer, t) result(g,answer) 25 26 27 main

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!