Search code examples
pythonanaconda

I don't know why I got the error: invalid literal for int() with base 10: ''


I'm running the program using a notebook on vscode and using anaconda base but I'm getting an error: "invalid literal for int() with base 10: ''" ở dòng k = int(input("k = ")). I don't see my mistake anywhere because when I use colab it still works normally I need help :((( enter image description here

I tried entering k = 3 directly and it worked normally but when I wanted to enter from the keyboard I got an error. enter image description here


Solution

  • Install Jupyter extension in your vs code and select the correct kernel in the top right corner of your Jupyter notebook in vs code
    select the correct kernel here

    Note that the input is in the top of vs code:
    input in the top

    If you don't pass a number to the input it will fail.