subject
Computers and Technology, 02.12.2020 21:50 peno211

Can someone translate this is Python language PLEASE! # A program to practice adding and multiplying.
# Initialize the number lists.
# Ask the user whether to practice adding or multiplying.
# Generate number problems and ask for an answer.
# Compare the user's answer to the correct answer.
# Keep score.
# Tell the user how they did.

# A program to practice adding and multiplying.
# Initialize the number lists.
numA = [4, 1, 6, 10, 2, 3, 7, 9, 11, 12, 5, 8 ]
numB = [2, 12, 10, 11, 1, 3, 7, 9, 4, 8, 5, 6]
numberFacts = len(numA)

# Ask the user whether to practice adding or multiplying.
print("You can add or multiply.")
mode = input("Enter A for add or M for multiply: ")
mode = mode. lower()

# Generate number problems and ask for an answer.
if mode == 'm':
for n in range(numberFacts):
print("What is", numA[n], "times" , numB[n], "?")
product = numA[n] * numB[n]
answer = input(" ")
try:
answer = float(answer)
except ValueError:
print("You did not enter a number. Try again on a new problem.")
print("")
continue
if answer == product:
print("Correct! Way to go!")
else:
print("Sorry, the answer is", product, ".")
print("")
elif mode == 'a':
for n in range(numberFacts):
print("What is", numA[n], "plus" , numB[n], "?")
product = numA[n] + numB[n]
answer = input(" ")
try:
answer = float(answer)
except ValueError:
print("You did not enter a number. Try again on a new problem.")
print("")
continue
if answer == product:
print("Amazing!")
else:
print("Sorry, the answer is", product, ".")
print("")
else:
print("You did not make a valid choice. You needed to choose A or M.")

# Below is the pseudocode before code was added

# Compare the user's answer to the correct answer.
# Keep score.
# Tell the user how they did.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:00
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_balance should be removed since header files should not contain constants.c)the definition of cashregister should be removed since header files should not contain class definitions.d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
question
Computers and Technology, 24.06.2019 07:20
Ingrid started speaking about her slide presentation. when she clicked to th"third slide, which had just a picture of an elephant, she forgot what she wassupposed to talk about. what could ingrid do to avoid this situation in thefuture? oa. print handouts for her audience.ob. add presenter's notes to each slide.oc. add a video to each slide.od. save her slide presentation to a flash drive
Answers: 2
You know the right answer?
Can someone translate this is Python language PLEASE! # A program to practice adding and multiplyin...
Questions
question
Mathematics, 06.10.2020 14:01
question
Mathematics, 06.10.2020 14:01
question
Mathematics, 06.10.2020 14:01
question
Mathematics, 06.10.2020 14:01
Questions on the website: 13722360