How to put elements from a list into new lines, whappened with a list, what exactly does "for...in....range" do, wrong solution
"""A group of buildings have restrooms every 5th floor. In other words, a building with 12 floors has restrooms on the 5th and 10th floors. Create a program that takes the total number of floors as input and outputs the floors that have restrooms. Sample Input 23 Sample Output 5 10 15 20 """ n = int(input())+1 bathrooms=list(range(5,n,5)) #There are 3 examples, first one print(bathrooms) #gives the result like "[5,10,15]" which is ok I guess #then this one for bathrooms in range(5,n,5): print(bathrooms) #gives the desired result which is also ok I guess, although I haven't quite comprehended this lesson (for .. in ... range) yet. #but if I repeat print(bathrooms) #now the result is "15". Can somebody explain whappened here? When and how was this redefined? Why this used to be a [list], now it's not? #also how would I put the result from the first example into new lines? I googled sep = '\n' but I'm still lost, not sure how to use it. #also I think the solution for this exercise on Sololea