def getProduct(n):
product = 1
while (n != 0):
product = product * (n % 10)
n = n // 10
return product
calc = list()
for number in range(10, 100):
num = getProduct(number)
if number == 2 * num:
calc.append(number)
print(calc)
So, the question is to have a column of two digit numbers, which is equal to the (product of the two digits * 2). How should I solve this problem?
i dont know what you mean but im guessing you need code for a two digit calulator
def multiply(x, y):
return x * y
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print(num1, "*", num2, "=", multiply(num1, num2))
def getProduct(n):
product = 1
if (n != 0):
product = product * (n % 10) * (n//10)
return product
calc = list()
for number in range(10, 100):
num = getProduct(number)
if number == 2 * num:
calc.append(number)
print(calc)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.