Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Python please. Thank you! (Computer-Assisted Instruction) Computer-assisted instruction (CAI) refers to the use of computers in education. Write a script to help an elementary school

image text in transcribedimage text in transcribedimage text in transcribed

Python please. Thank you!

(Computer-Assisted Instruction) Computer-assisted instruction (CAI) refers to the use of computers in education. Write a script to help an elementary school student learn floor division. Create a function that randomly generates and returns a tuple of two positive one-digit integers. Use that function's result in your script to prompt the user with a question, such as How much is 6 // 72 For a correct answer display the message "Very good!" and ask another question. For an incorrect answer, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. After a correct answer is given, the student is given another question if they want to play again. Your script will log the activities to a database table named "cai" and display the table at the end. A sample session follows: How much is 5 // 2? Enter your answer... 5 No. Please try again. Enter your answer. 3 Don't give up! Enter your answer... 2 Excellent! Play again? Enter 'yes' or 'no' yes How much is 4 // 8? Enter your answer...2 Very good! Play again? Enter 'yes' or 'no' no Thank you for playing! Now showing the content of the CAI table: 1 2 3 4 5 6 idCAI digiti digit2 guesses results 601 7 5 e Incorrect 602 2 9 2 Incorrect 603 2 2 2 Incorrect 684 5 2 5 Incorrect 605 5 2 3 Incorrect 606 5 2 2 Correct 687 4 8 Correct Additional requirements: 1. Use a separate function to check answers. 2. Vary comments displayed for each answer. Possible responses to a correct answer should include 'Very good!', 'Excellent!', 'Nice work!' and 'Keep up the good work!' Possible responses to an incorrect answer should include 'No. Please try again.' 'Don't give up!'. 'Wrong. Try once more.' and 'No. Keep trying.' Store the computer's responses in lists. Use random-zumber generation to select responses using random list indices. 3. The user wants you to capture each question and answer for assessment purposes. Use a separate function to print outputs to a file (using the append mode). Save the two integers, the student answer, and whether the answer was correct to a csv file (see below). De 4. Also save the same data to a table named "cai" in a test database. The database can be accessed using the following connection: mydb-mysql.connector.connect host="10.209.50.77", user="test". password="test", database="test" ) The cai table should have the following rows after execution of your script. The first column is automatically filled by the system and your script should insert data into the other four columns: digitl digit2, guesses, and results. Note that the table is shared so it will have rows inserted by other users, but your rows are at the bottom of the table, as illustrated in the sample session. DAI 601 602 603 604 605 606 602 doti 7 2 2 5 5 5 4 digit2 5 9 2 2 2 2 2 guesses 0 2 2 5 3 2 results Incorrect Incorrect Incorrect Incorrect Incorrect Correct Contacte

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students explore these related Databases questions