Python Forum
Running input() from mac terminal
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running input() from mac terminal
#1
Hi all -
Total newbie question here...just getting started.
I'm running Python3 3.8.3.

Wondering what I'm doing wrong here.

Here's my code...

prompt = "Please enter your name"
prompt += "\nName: "

name = input(prompt)

print("Hello, {name}!")

When I run on my mac terminal, I get this output... my name isn't showing up... "{name}" does.

JonathaettsMBP2:python_work jdhamblett$ python3 greeter
Please enter your name
Name: Jonathan
Hello, {name}!

Apologies if this has been asked a million times.
Thanks so much for the assistance.
Reply
#2
  • Please use proper tags while coding - see BBCode to know more
  • Your print statement should be
    print(f"Hello, {name}!")
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#3
(Jun-15-2020, 04:07 PM)pyzyx3qwerty Wrote:
  • Please use proper tags while coding - see BBCode to know more
  • Your print statement should be
    print(f"Hello, {name}!")

Ugh - thank you... I'm an idiot. Appreciate your help!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Running latest Python version on the Terminal (MAC) Damian 4 2,647 Mar-22-2021, 07:58 AM
Last Post: Damian
  Refresh data in python script while running in Terminal frankenchrist 4 7,291 Feb-03-2021, 09:54 AM
Last Post: Larz60+
  read terminal text from running program AArdvark_UK 2 1,891 Aug-27-2020, 12:43 PM
Last Post: AArdvark_UK
  How do you take terminal inputs w/o halting running code? Bhoot 3 2,597 Apr-17-2020, 08:31 AM
Last Post: deanhystad
  running python script from shell invoked with os.system("x-terminal-emulator -e /bin/ markhaus 2 3,076 Feb-21-2019, 11:55 PM
Last Post: markhaus
  input function visual studio terminal help JJG 1 3,093 Dec-06-2017, 04:32 AM
Last Post: JJG
  How do I accept input from the terminal when I execute my file? cocoa1231 1 4,142 Dec-08-2016, 11:22 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020