Welcome to Westonci.ca, the place where your questions are answered by a community of knowledgeable contributors. Join our Q&A platform and get accurate answers to all your questions from professionals across multiple disciplines. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.
Sagot :
Answer:
Explanation:
The following Python program has a function called addDigits which takes a number as a parameter and returns the sum of the digits. Then the program creates a loop that keeps creating random numbers between 222 and 1000 and divides it by the value returned from the function addDigits. If the remainder is 0 is prints out a statement and breaks the loop, ending the program. The picture below shows the output of the program.
import random
def addDigits(num):
sum = 0
for x in str(num):
sum += int(x)
return sum
sum = addDigits(random.randint(222, 1000))
while True:
myRandomNum = random.randint(2, 99)
if (sum % myRandomNum) == 0:
print("No remainder between: " + str(sum) + " and " + str(myRandomNum))
break

Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. Find reliable answers at Westonci.ca. Visit us again for the latest updates and expert advice.