list_1 = [i for i in range(1, 51)]
a=int(input())
list_1.remove(a)
count=0
for i in list_1:
if(i%a==0):
count=count+1
print(count)
(rescued from the browser Inspect option and turned into code with the 101/010 button), and by your description you want:
list_1 = [i for i in range(1, 51)]
a=int(input())
list_1.remove(a)
count=0
for i in list_1:
if(i%a==0):
count=count+1
print(count)
… that is, complete the loop before reporting.
The main thing to learn here is that you are in charge of the indenting. The editor may suggest an indent if you want to stay in the current control structure, but you don’t want to add statements to the if or indeed the for actions. Bring the indent back as shown and the print is then a post-for-loop action. In Python, indents are part of the language.
Having said that - you don’t really need the loop or the reference array; you know (don’t you?) in your example case that there are 4 multiples of 12 up to 50 without counting through all the non-multiples, and you can just subtract off one to discard the instance of 12 itself. There are various ways to do this in Python which I’ll leave you to discover.
Python works on indentation which is not clear in your code by your question but what I can guess that is you may have put print(count) statement in if(i%a==0) condition.