Find the best answers to your questions at Westonci.ca, where experts and enthusiasts provide accurate, reliable information. Experience the convenience of getting reliable answers to your questions from a vast network of knowledgeable experts. Get immediate and reliable solutions to your questions from a community of experienced professionals on our 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
Thank you for choosing our service. We're dedicated to providing the best answers for all your questions. Visit us again. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Westonci.ca is committed to providing accurate answers. Come back soon for more trustworthy information.