-1

I have configured Sublime text 3 to compile and execute Python 3.5 code and have successfully run several small programs. However when I try and run this simple code to calculate the square of a number the user can input, the console will not return the final answer:

def square():
  num = int(input("Please enter the number you wish to square: "))
  answer = num ** 2
  print (answer)

square()

In Sublime Text 3 it will ask the user for input but then not print the answer. If I run it in IDLE though it will print the answer. As I said I can run other small programs involving print (like Hello World for example) so I am not sure what is wrong. All help appreciated I am just starting out so please forgive my lack of experience.

1 Answers1

0

I was able to run your code through my terminal. It ran perfectly. I wrote the same code in Sublime Text 3 as I use the same editor. I don't think there is any input/output exception for sublime. You might want to restart the terminal and then try creating a new .py file to run this code.

Please zoom the image to see your output.