简体   繁体   中英

error :n=int(input()) ValueError: invalid literal for int() with base 10: 'N/A'

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM