+ 1
[SOLVED] Why is this Python code not working?
n=int(input()) d=input() for i in range(n) if d in str(i) print(i)
6 Answers
+ 7
The for and if needs colons after them, and the code inside the for and if need to be indented.
for i in range(n):
if d in str(i):
print(i)
+ 6
Welcome, bro! š
+ 5
You mean indents?
Code inside structures like ifs, fors, whiles, and functions/methods in Python needs to be indented. Usually, indents are 4 spaces.
+ 1
they always need colons?
+ 1
Can you please tell me about indent?
+ 1
Thank you bro