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

27th Jul 2022, 3:36 PM
Xx fox31 xX
Xx fox31 xX - avatar
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!
27th Jul 2022, 4:00 PM
Per Bratthammar
Per Bratthammar - avatar
+ 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
27th Jul 2022, 5:17 PM
Xx fox31 xX
Xx fox31 xX - avatar
+ 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)
27th Jul 2022, 6:03 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Thank you sir Sorry for wasting your time
27th Jul 2022, 6:06 PM
Xx fox31 xX
Xx fox31 xX - avatar
+ 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
28th Jul 2022, 11:25 PM
Ammar Alhassan