Skip to content
AgileLogics
3 min read

Input and Output

Prerequisites: Strings

print() writes text out; input() reads a line of text the user types in, always as a string.

name = input("What is your name? ")
print(f"Hello, {name}!")

Common mistakes

  • Forgetting that input() always returns a string, even if the user types a number — input("Age: ") gives "25", not 25. Convert it with int(...) before doing math with it.