Nearest Bathroom Practise (From Lists topic) - Test Case Error
I tried to code using lists and for loops to find the nearest bathroom. But one of the test case validation failed. I couldn't spot the error. Kindly help me on this. Below is the description & code. Thanks. Description: A group of buildings have restrooms on every 5th floor. For example, 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 Code: n = int(input()) if n%5 == 0: x = list(range(5,n,5)) for y in x: print(y) elif n%5 == 1: x = list(range(5,n,5)) for y in x: print(y) elif n%5 == 2: x = list(range(5,n-1,5)) for y in x: print(y) elif n%5 == 3: x = list(range(5,n+3,5)) for y in x: print(y) else: x = list(range(5,n+4,5)) for y in x: print(y)