When I typed the example code: on https://docs.python.org/3/tutorial/controlflow.html in terminal, it always prompt:What's wrong?
Code:
for n in range(2, 10): for x in range(2, n): if n % x == 0: print(f"{n} equals {x} * {n//x}") break4 equals 2 * 26 equals 2 * 38 equals 2 * 49 equals 3 * 3Code:
File "<stdin>", line 4 print(f"Found an even number {num}") ^SyntaxError: invalid syntaxStatistics: Posted by MianQi2019 — Tue Oct 21, 2025 3:37 am