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!
Thank you for the post
LikeLike