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, 23.06.2019 14:00
How are stop motion special effects in animated films created
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Your mom wants to purchase a laptop computer. she said she wants her new computer to be able to play her dvds so she can listen to music and wants to know what type of optical drives will play her disk. which type of drive should she look for?
Answers: 1
question
Computers and Technology, 24.06.2019 13:20
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
You know the right answer?
Can someone translate this is Python language PLEASE! # A program to practice adding and multiplyin...
Questions
question
Mathematics, 06.11.2020 06:30
question
Chemistry, 06.11.2020 06:30
question
Mathematics, 06.11.2020 06:30
question
Mathematics, 06.11.2020 06:30
question
Mathematics, 06.11.2020 06:30
Questions on the website: 13722360