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
I don't get what you mean I'm sorry i can't answer you question
Answer:
Writing an essay to robots is very bad. The robots could steal your information and essay. Never share essays with robots.
Explanation:
Answer:
Written in Python
age = int(input("How old are you? "))
for i in range(1,age+1):
print("**HUG**")
Explanation:
The first line prompts the user for age
age = int(input("How old are you? "))
The next line is an iteration that starts from 1 till the user input
for i in range(1,age+1):
The last line prints "**HUG**" while the iteration is true
print("**HUG**")