Why can't I get print()?
i'm new with this and i'm using Sublime Text 3 to learn python.
I'm trying to run a simple code
name = input("What is your name: ") age = int(input("How old are you: ")) year = str((2014 - age)+100) print(name + " will be 100 years old in the year " + year)
I tried eveything to use SublimeRepl, but when I try to run, the console only gives me "What is your name:", nothing more, even if I write a name and press enter, nothing comes from it. Then I saved and tried to run with cmd, but I only get this
If I type any number, the cmd closes and I don't get the print() that is in the code. What I'm doing wrong? And why SublimeRepl doesn't work for me?作者: Royalsaint 的来源 发布者: 2017 年 12 月 27 日
What happens is that your interpreter and shell exit before you see the output. Just do as @CristiFati suggested, add an instruction that takes an additional input, that will prevent the interpreter from exiting before you see the result:
作者: Anna-Chiara Bellini 发布者: 27.12.2017 06:07
input("Press ENTER to exit...")