Check Digit Count Type

Check whether a given integer is single-digit, double-digit, or multi-digit.

Logic BuildingIntermediate
Logic Building
# Take number
num = abs(int(input("Enter a number: ")))

# Check digit count
if num < 10:
    print("Single-digit")
elif num < 100:
    print("Double-digit")
else:
    print("Multi-digit")

Output

Enter a number: 5
Single-digit

Enter a number: 45
Double-digit

Enter a number: 123
Multi-digit

Use range checks to determine digit count.

Key Concepts:

  • Single-digit: 0-9 (< 10)
  • Double-digit: 10-99 (< 100)
  • Multi-digit: 100+ (>= 100)
  • Use abs() to handle negative numbers