Skip to content
    Hack The FutureHack The FuturePython Notes

    UNIT 01 · TOPIC 14

    Input and Output

    Use input() to read text from a user and print() to display values; convert input when you need numbers.

    The idea

    Input and Output, simply explained

    Use input() to read text from a user and print() to display values; convert input when you need numbers.

    01

    See the big picture

    How the idea flows

    Input or goalInput and OutputPython result
    Understand the problemApply Input and OutputRun the codeCheck the output

    Read the diagram as a simple path: begin with a problem, use the Python idea, then verify the result.

    02

    Everyday connection

    Real-life example

    ↗

    A checkout asks for quantity, converts it to a number and displays the bill.

    03

    Learn by doing

    Python code example

    PYTHONExample
    quantity = int(input('Quantity: '))
    print('Total:', quantity * 35)
    Expected resultFor input 3: Total: 105
    Try it: Change one value in the code, predict what will happen, then run it and compare your answer.
    04

    Keep this in mind

    Key takeaways

    • Use input() to read text from a user and print() to display values; convert input when you need numbers.
    • Think of a real problem where input and output could save time or organize information.
    • Test small changes and read the result carefully before moving to a bigger program.

    Quick self-check

    Can you explain it in your own words?

    What is the main idea of Input and Output?

    Use input() to read text from a user and print() to display values; convert input when you need numbers.

    Where could you see this idea in everyday life?

    A checkout asks for quantity, converts it to a number and displays the bill.

    Keep learning · Hack The Future