Python input() function
Python input() function
The input() function in Python reads a line from input and converts it to a string (stripping a trailing newline).
Syntax
input([prompt])
Parameter
prompt: This function represents a string, depicting a default message before the input.
Return
This function returns the string value if the prompt argument is present and it is written to standard output without a trailing newline.
Example 1
# Python program explaining # the input() function str1 = input("Enter your name:") print("Hello, " + str1)
Output
Enter your name:reema Hello, reema