← All references

input()

input(prompt=None)

Read a line of input from the user.

input()

Reads a line from standard input, returns it as a string (without the trailing newline). Use int() or float() to convert to a number.

Note: In the w3primecode sandbox, input() returns immediately — pre-stored input is used.

Example

name = input("What is your name? ")\nprint(f"Hello, {name}!")\n\nage = int(input("Age? "))\nprint(f"Next year: {age + }")