HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to Python: Print and RepeatVariablesData Types & NumbersStringsListsConditions (if / elif / else)Loops (for / while)FunctionsOperatorsDictionariesTuples & SetsError Handling (try / except)Classes (Object-Oriented)File OperationsComments & IndentationBooleans (True / False)Lambda & map / filterModules (import)InheritanceVariable Scope
REFERENCE
📖 Overview
🖥️ Output & Input
print()input()f-string
🔢 Numbers & Math
✍️ String
📋 List
🗂️ Dictionary & Set
🔁 Condition & Loop
🧩 Function
📁 File & Error
🔄 Type & Conversion
Python›REFERENCE›Output & Input›input()

input()

Takes text input from the user via the keyboard.

Syntax

input(message)

Description

Prints an optional message to the screen and returns the line written by the user as TEXT (str). If you need a number, you must convert it using int() or float().

Parameters

message(optional)The prompt text to show the user.

Returns

The line the user typed (str).

Example

Loading editor…

This language is for reference/learning only — copy the code and try it in your own environment.

Expected output

(After entering the name) Hello Alex

When to use?

For getting a name, number, or choice from the user in small console programs.

Common mistakes

  • ⚠️ input() always returns text; for arithmetic, convert it like yas = int(input()).

Related commands

print()int() / float()
← print()f-string →
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code