Function Details: input

Description


Reads a string from standard input.


Extended Description


The input() function prompts the user for input and returns the entered string. If the optional 'prompt' argument is provided, it is printed to the console without a trailing newline before reading input. The function always returns a string, stripping the trailing newline.


Read More about input from Python Documentation

Function Signature


input(prompt: Optional[str] = None) -> str

Module: builtins

Parameters



Parameter List


  • prompt: Optional[str]

Return


Returns a string containing the line read from the user input.


Return Type


str

Output

Explanation

This example demonstrates the basic usage of input() to get a user's name and then greet them.