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 06:00
Which statement is true of web-based social media? a.they allow consumers to interact with and update content. b.they cannot be updated easily, as compared to print media. c.they are expensive to produce and maintain, as compared to print and television. d.they can exist independent of the internet.
Answers: 1
question
Computers and Technology, 24.06.2019 18:20
7. design a circuit with three inputs (x, y, and z) representing the bits in a binary number, and three outputs (a, b, and c) also representing bits in a binary number. when the input is 1, 2, or 3, the binary output should be one lesser than the input. when the input is 4, 5, or 6, the binary output should be one greater than the input. when the input is 0, the output is 0, and when the input is 7, the output is 7. show your truth table, all computations for simplification, and the final circuit.
Answers: 2
question
Computers and Technology, 24.06.2019 18:30
Is a type of bullying that takes place when a person intentionally posts negative information about another person that is not true.
Answers: 2
question
Computers and Technology, 25.06.2019 01:40
The instantiation of an endpoint in a potential tcp connection is know as
Answers: 1
You know the right answer?
Can someone translate this is Python language PLEASE! # A program to practice adding and multiplyin...
Questions
question
History, 07.04.2020 06:09
question
Social Studies, 07.04.2020 06:09
question
Mathematics, 07.04.2020 06:09
Questions on the website: 13722360