There's always a possibility that's an issue with the page formatter for code. I know Confluence can be a bit funny about that if you paste into a code block.
Maybe this indent decided to leave the print statement (where it is destined to be)
for x in c:
print(x)
# Recommended
cities = [âUKâ, âUSAâ, âUAEâ]
for city in cities:
print(city)
and moved in with that for loop neighbor against all odds.
Seriously, indent really matters in Python. As well as the case (especially for keywords), so Pass instead of pass
# Recommended
def fetch_users():
# do something
Pass
will trigger a NameError unless there is a variable named Pass.
And speaking of technical debt, these two kinds of bugs (wrong indentation and case incosistency) in poorly written Python code are sneaky enough to go unnoticed since they may not trigger any error messages in some cases.
For loop should also not be indented...
There's always a possibility that's an issue with the page formatter for code. I know Confluence can be a bit funny about that if you paste into a code block.
Maybe this indent decided to leave the
print
statement (where it is destined to be)and moved in with that
for
loop neighbor against all odds.Seriously, indent really matters in Python. As well as the case (especially for keywords), so
Pass
instead ofpass
will trigger a NameError unless there is a variable named Pass.
And speaking of technical debt, these two kinds of bugs (wrong indentation and case incosistency) in poorly written Python code are sneaky enough to go unnoticed since they may not trigger any error messages in some cases.
Also, the quotation marks in the
cities
list are not"
(\x22
) butâ
(\u201C
) andâ
(\u201D
) unicode characters. It would raiseSyntaxError
.