num = int(input('Give me a 3 digit number! :'))
div1 = 100
div2 = 110
div3 = 36
hundreds = num // div1
tens = num // div2
ones = num // div3
print("In %d there are %d hundred(s) %d ten(s) and %d ones are found" % (num, hundreds, tens, ones))
Output (It should be; "In 187 there are 1 hundred(s) 8 ten(s) and 7 ones are found")
The real results
Give me a 3 digit number! : 187
In 187 there are 1 hundred(s) 1 ten(s) and 5 ones are found
>Solution :
Use the modulus operator:
num = int(input('Give me a 3 digit number! :'))
hundreds = num // 100
tens = num % 100 // 10
ones = num % 10
print("In %d there are %d hundred(s) %d ten(s) and %d ones are found" % (num, hundreds, tens, ones))
Result:
Give me a 3 digit number! :187
In 187 there are 1 hundred(s) 8 ten(s) and 7 ones are found