Enter value from command prompt in python

Place value from command prompt in python

Enter the value in python program from command prompt:

# Accept a string input from the user
name = input("Enter your name: ")

# Print a greeting using the input value
print("Hello, " + name + "!")

Note: input() function always returns a string value, so you may need to convert it to a different data type if you need to use it in numeric calculations or other operations. You can do this using the appropriate conversion function, such as int() or float().

Run the as python program and save as py extention.

C:\Users\ersan\Desktop>python 1.py
Enter your name: RAKESH
Hello, RAKESH!
This entry was posted in Python on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

2 thoughts on “Enter value from command prompt in python

Leave a Reply