for num in range(1,10):
if num == 15:
print(num,"this is found")
print(num,"this is not found")
The code loops through numbers 1 to 9 and checks if any equals 15. Since 15 is not in that range, the `if` block never runs. After the loop, the final `print` shows the last value of `num` (which is 9), so it prints "9 this is not found".
- The `if` condition inside the loop will never be true because `range(1,10)` stops at 9. Think about what range would include 15, or whether you intended to search a different set of numbers.
- The final `print` is outside the loop, so it only runs once after the loop ends. Consider where you want the "not found" message to appear—inside the loop or after it—and how to track whether a match was found.