Code runs fine in jupyter notebook but gives error in hacker rank
n=int(input())
for i in range(0,99):
n= n+1
if (n % 3 == 0 and n % 5 == 0):
print('FizzBuzz')
elif (n % 3 == 0 and n % 5 != 0):
print('Fizz')
elif (n % 3 != 0 and n % 5 == 0):
print('Buzz')
else:
print(n)
I guess, that is the problem - n = int(input())
Maybe, hacker rank does not support input
construction. Try to replace it for random value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.