0

I'm trying to code a simple calculator using Python (2) in Sublime Text that consists of asking the user for the first number, the operation, then the second number. However, every time I try to execute the code in Sublime, I can't get past the first user input.

num1 = int(raw_input("Enter your first number:"))
operation = raw_input("Enter your operation:")
num2 = int(raw_input("Enter your second number:"))

This works in IDLE, i.e. I hit enter after I enter a number and it prompts for an operation. Is there a different way to do this in Sublime?

traumerisch
  • 207
  • 1
  • 4
  • 10

1 Answers1

1

Sublime text doesn't support input from the console, it's just an out console, anyways there's a way around, you can use SublimeREPL. You get a full IDLE like console embedded right into the sublime text!

Quotting what you get:

Launch python in local or remote(1) virtualenv.

Quickly run selected script or launch PDB.

Use SublimeText2 Python console with history and multiline input.

You can install it from package control(I guess you already have package control! If not get it from here).

Community
  • 1
  • 1
Devi Prasad Khatua
  • 1,185
  • 3
  • 11
  • 23
  • Exactly this, I use this for my Python scripts also. Additional FYI: Package Control automatically keeps all your packages up to date, I strongly recommend you get it over manually installing SumlimeREPL. – rjmd Jul 04 '16 at 05:33