0

I am currently learning about user input and while loops. Here is an example:

name = input("Please enter your name: ")
print(f"\nHello, {name}!")

As a result the only output I get is:


Please enter your name:

Whereas the book I am reading has a different output:


Please enter your name: Eric Hello, Eric!

How do I get the second output?

  • Did you try to type something after you've seen the prompt? – Enrico Sep 15 '20 at 03:38
  • They do not support it. [See this](https://stackoverflow.com/a/10605079/8153505) – namgold Sep 15 '20 at 03:40
  • I tried typing in the output window "Alex" and then pressed enter. Nothing happened... – alexcm113 Sep 15 '20 at 03:41
  • Python programming is not what the Sublime Text console is good for. Install python 3 and run the `python` command, or set up ipython, or use an online python interpreter. – Jerry101 Sep 15 '20 at 03:51
  • @Nam Nguyen I use Sublime Text 3, but will follow your link anyway to see if I solve this problem – alexcm113 Sep 15 '20 at 04:20
  • @Jerry101 I have Python 3.8 Do you mean to run the code in the command prompt - python? – alexcm113 Sep 15 '20 at 04:23
  • Subl 3 still not support it @alexcm113 – namgold Sep 15 '20 at 04:24
  • Yes, @alexcm113, run the `python` command, which opens an interactive python shell, then type the `name =...` and `print...` commands into it. If `python` runs Python 2.7 on your computer, try the `python3` command or else install [pyenv](https://github.com/pyenv/pyenv) and use that to install a Python 3 virtual environment. – Jerry101 Sep 15 '20 at 16:33

0 Answers0