Logic Building
# Take two numbers
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
# Check conditions
if num1 > 0 and num2 > 0 and (num1 + num2) < 100:
print("Both positive and sum < 100")
else:
print("Condition not met")Output
Enter first number: 30 Enter second number: 40 Both positive and sum < 100 Enter first number: 50 Enter second number: 60 Condition not met
Check multiple conditions with AND.
Key Concepts:
- Both numbers must be positive
- Sum must be less than 100
- Use AND to combine all conditions