I have a problem with Python 3.7 and Sublime when using "input"

0

1) Enter the following code in Sublime Text 3

print(5)
edad = int(input("Ingrese su edad: "))
print(edad)

2) By console I get the following:

5
Ingrese su edad:

And regardless of the number you enter, the program does not do anything else, it goes blank. When exercised in Python IDLE, however, the program runs perfectly.

Does anyone know what could be the problem with the Sublime Text?

    
asked by fedediablo17 12.09.2018 в 23:51
source

2 answers

0

The reason is because Sublime by default does not support what you want to do.

Although I have not used it, you could try installing this package SublimeREPL to have that functionality.

Likewise, you can do your tests directly from the terminal looking for the file and executing it.

    
answered by 13.09.2018 в 04:35
0

What you can do to interact with the Python inputs is to create a new build and there will automatically be a console where the program runs.

  • Open SublimeText and click on the Tools option, then click on the Buil System option and a list of supported languages will open and click on the last option New Build System

  • A document will be opened in Sublime with the generic configuration of a shell.

  • Replaces everything with the following text. Where the "C: / Python / python.exe" part should be replaced by the path where the Python program is stored on your computer.

    { "cmd: ["start", "cmd", "/k", "C:/Python/python.exe", "$file"],
      "Selector": "source.python",
      "Shell": true,
      "working_dir": "$file_dir"}
    
  • Press the "Ctrl + s" keys and assign a name once saved, go back to where the Build System is and select the name you gave to your new configuration.

  • From now on, pressing "Ctrl + b" will open the file in a console and it will be faster and easier to interact with the program.

        
    answered by 16.09.2018 в 02:26