1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
NemiM [27]
3 years ago
15

Write a program that teaches arithmetic to a young child. The program tests addition and subtraction. In level 1 it tests only a

ddition of numbers less than 10 whose sum is less than 10. In level 2 it tests addition of arbitrary one-digit numbers. In level 3 it tests subtraction of one-digit numbers with a nonnegative difference. Generate random problems and get the player input. The player gets up to two tries per problem. Advance from one level to the next when the player has achieved a score of five points.
Computers and Technology
1 answer:
Natasha2012 [34]3 years ago
7 0

Answer:

import random

class Arithmetics(object):

   trial = 2

   score = 0

   is_end = "Y"

   

   def start(self):

       while self. is_end == "Y":

           self. level1()

           self. level2()

           self. level3()

           self. is_end = input("Do you want to play again? Y/N: "). upper()

       quit()

   def level1(self):

       print("--------------------Level 1--------------------\n\n Addition:")

       for _ in iter(list, 0):

           num1 = random.randint(1,5)

           num2 = random.randint(1,5)

           if self. score == 5:

               print("Congrat! advance to next level\n")

               self. init_()

               break

           print(f"{num1} + {num2}")

           result = int(input("Your answer: "))

           if result == num1 + num2:

               self. increase_score()

           elif self. trial == 0:

               print("Sorry dear, you failed to pass the text.")

               self. end_game()

           else:

               self. trial_reduce()

   def level2(self):

       print("--------------------Level 2--------------------\n\n Addition again:")

       for _ in iter(list, 0):

           num1 = random. randint(1,9)

           num2 = random. randint(1,9)

           if self. score == 5:

               print("Congrat! advance to next level\n")

               self. init_()

               break

           print(f"{num1} + {num2}")

           result = int(input("Your answer: "))

           if result == num1 + num2:

               self. increase_score()

           elif self. trial == 0:

               print("Sorry dear, you failed to pass the text.")

               self. end_game()

           else:

               self. trial_reduce()

   def level3(self):

           print("--------------------Level 3--------------------\n\n Subtraction:")

           for _ in iter(list, 0):

               denum = random. randint(6,9)

               num = random. randint(1,5)

               if self. score == 5:

                   self. init_()

                   self. end_game()

                   break

               print(f"{denum} - {num}")

               result = int(input("Your answer: "))

               if result == denum - num:

                   self. increase_score()

               elif self. trial == 0:

                   print("Sorry dear, you failed to pass the text.")

                   self. end_game()

               else:

                   self. trial_reduce()

   #classmethod

   def trial_reduce(cls):

       cls. trial -= 1

   #classmethod

   def increase_score(cls):

       cls. score += 1

   #classmethod

   def init_(cls):

       cls. trial = 2

       cls. score = 0

   def end_game(self):

       print("Congrats kiddo! You are a math wiz.")

game = Arithmetics()

game. start()

Explanation:

The python class defines the arithmetics class with three-level mathematics for children defined as methods for the class. There are three class methods namely; 'trial_reduce', 'increase_score', and 'init_' with each of them decreasing the trial attribute, increasing the score attribute by one, and initializing the class attributes to its initial state.

The 'end_game' prints a message at the end of the program. Each level is in a loop and counts five times if the answers are correct.

You might be interested in
which type of classroom enable students to attend lectures without being physically present with the teacher
nadezda [96]

A browser-based, virtual classroom with a facility of web conferencing platform developed for teaching online.

It can create the online school, manage courses of studies and users and make face to face interaction between the teacher and the student.

An approach is different than some of the other platforms out there as the motive is to deliver a platform that presents your classes, workshops and tutoring sessions in a modern, professional way.

Live virtual classrooms enable students to attend lectures without being physically present in the classroom

--

6 0
3 years ago
Read 2 more answers
Most licensing agencies offer an orientation meeting for applicants who want to obtain licensing for a child care facility or a
Eva8 [605]
The correct option is C.
Licensing agencies organised orientation meetings for those newly seeking day care facility license in order to educate  and familiarize them with the requirements that must be met and the laws and regulations that govern operating a day care facility. This orientation meeting usually equipped the participants with the information they need to succeed in the business.<span />
5 0
3 years ago
Read 2 more answers
Your company is implementing a wireless network and is concerned that someone from a competing company could stand outside the b
Mila [183]

Answer:

(A)AES

Explanation:

WPA2 (Wi-Fi Protected Access 2) is a security protocol which was developed by the Wi-Fi Alliance in 2004. It was used to replace the security protocol of WEP(Wired Equivalent Privacy) and WPA.

Unlike the previous security protocol, WPA2 uses the Dvanve Encryption Standard (AES) instead of the RC4 stream cipher. WPA3 has been developed but it is not yet widely in use.

4 0
3 years ago
The _________ check is a type of hardware control that involves adding a "1" or a "0" to the end of every 8 bit byte such that t
stira [4]

Answer:

The correct answer to the following question is an option (b) parity.

Explanation:

Because it is a bit that appends to the binary bit and it has the sets of one or either zero by which a total number of the one bits is the odd or the even parity bit.  

Parity bit is a type of bit by which we can check when the data is moved to another place than at that time the data is written over or lost and also we check data at that time when these data is transmitted from one computer to other computers.

7 0
3 years ago
What is required to become a good critical thinker? Use a process when dealing with a big issue. Practice the right skills over
Damm [24]

Answer:

Evaluate issues based on logic and reason

Explanation:

Critical Thinking is the ability to think scientifically & logically, analysing based on both formers - rather than rule of thumb.

Critical thinker engages clearly in conceptual, rational thinking. So, an important desirable characteristic of a critical thinker is 'evaluating issues based on logic and reason'.

6 0
3 years ago
Other questions:
  • Attention merchants define
    5·1 answer
  • The ____ function sums the numbers in the specified range and then divides the sum by the number of cells with numeric values in
    14·1 answer
  • IF ACCURATE = BRAINLY (if u answer rubbish randomness= reported AND if you got questions dont ask in answer slot= reported)
    13·1 answer
  • In this challenge, write a function to add two floating point numbers. Determine the integer floor of the sum. The floor is the
    8·1 answer
  • Consider the program below: public class Test { public static void main( String[] args ) { int[] a; a = new int[ 10 ]; for ( int
    5·1 answer
  • Can someone explain what Bytes are? I would really like to know.
    5·2 answers
  • Why are control components necessary in traditional software and generally not required in object-oriented software?​
    11·1 answer
  • There u go i did thereeeeeeeeeeeeeeeeeeeeeee
    13·2 answers
  • Write long answer to the following question. a. Define microcomputer. Explain the types of microcomputers in detail.​
    5·2 answers
  • How do we ensure that future technologies are fair to society?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!