Complex Number Validation

Apply multiple conditions to validate number properties.

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

# Check multiple conditions
is_positive = num > 0
is_even = num % 2 == 0
is_two_digit = 10 <= num <= 99
sum_of_digits = sum(int(d) for d in str(num))
sum_is_even = sum_of_digits % 2 == 0

if is_positive and is_even and is_two_digit and sum_is_even:
    print("Number meets all criteria")
else:
    print("Number does not meet all criteria")

Output

Enter a number: 24
Number meets all criteria

Enter a number: 25
Number does not meet all criteria

Combine multiple conditions using logical operators.

Key Concepts:

  • Check multiple properties: positive, even, two-digit
  • Calculate sum of digits
  • Use AND to ensure all conditions met
  • Break complex logic into smaller checks