0
Is there a bug in ( practice of Nearest Bathroom at Python course) I can't pass it even when I get the right answers
5 Answers
+ 1
Hi, Xx fox31 xX !
Is it a bug in what? In SoloLearns Python course or your code?
If you mean your code, there is still not much to go on, to answare your question; I canât see any code of yours! Also bring the problem task here!
+ 1
Hi Per Bratthammar 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
MY CODE
https://code.sololearn.com/ck4M8twjSXRB/?ref=app
+ 1
# Hi! The problem is you havenât set the range to k+1. Because of this, you will miss the last floor when k%5 == 0:
k = int(input())
f = list(range(5, k + 1, 5))
for x in f:
print (x)
+ 1
Thank you sir
Sorry for wasting your time
+ 1
Xx fox31 xX But if you have 25 floors there will be bathroom on the 25th floor your code will miss it. You should use k+1 in the range for the last number to be inclusive