Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that takes two positive integers as input parameters,1 and 2. Assume 1 2. For any number, , where 1 2, if is

Write a function that takes two positive integers as input parameters,1 and 2. Assume 1 2. For any number, , where 1 2, if is divisible by each of its digits, print . For example, if 1 = 30 and 2 = 50, then your function should print 33, 36, 44, 48, because: 33 % 3 = 0 36 % 3 = 0 and 36 % 6 = 0 44 % 4 = 0 48 % 4 = 0 and 48 % 8 = 0

I currently have the following, but am struggling to incorporate to a function that uses a range of values inputted by the user:

import numpy as np

dgt = [] dgt1 = [] a = 33

def dvdgt(a): dgt = (str(a)) length = len(dgt) z = 0 while z < length: for x in dgt: y = int(x) dgt1.append(y) z += 1 chk = np.array(dgt1) if np.any(chk == 0): print("FAIL") break if np.all(a % chk == 0): print(a) else: print("FAIL")

dvdgt(a)

In addition to the function, please write some code to test the function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

LO1 Explain how the workforce is changing in unpredicted ways.

Answered: 1 week ago