0

I'm trying to create a program that will multiply each digit with a number in the list in order

so lets say my inputted number is 1234, then

  • 1 will be multiplied by 4
  • 2 will be multiplied by 8
  • 3 will be multiplied by 5, and so on
frequentNum = input("please enter 4 digit frequent number: ")
arr = [4, 8, 5, 7]
for i in str(frequentNum):
  for j in arr:
    value = int(i) * j 
    print(value)

I tried this code but it multiplies each digit with every number in the list

I was trying to get an output of

4
16
15
28
I_love_vegetables
  • 1,575
  • 5
  • 12
  • 26

0 Answers0