Q3: Put the code in the right order to create a program that will generate an integer between 0 and 10,000 (inclusive), print the number, calculate and print the number of digits in the number.
import random
x = random.randint(0, 10000)
---
digits = 0
y = x
---
while y > 0:
---
digits += 1
y = y // 10
---
print(x, "has", digits, "digits.")
Q4: Put the code in the right order to create a program that will print out all Armstrong numbers between 1 and 500. If the sum of the cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = (1*1*1) + (5*5*5) + (3*3*3)
for i in range(1, 500):
---
dig1 = i // 100
dig2 = (i // 10) % 10
dig3 = i % 10
---
total = dig1**3 + dig2**3 + dig3**3
---
if total == i:
---
print(i, "is an Armstrong number.")