loop
← All sections

Module 2 · Python data types, variables, operators, and basic I/O operations

Interaction with the user

Until now your programs only spoke. Now they listen: read what the user types with input(), and turn that text into numbers you can compute with.

Begin lesson 1 →
  1. 1The input() functionPause the program and read a line the user types — with a prompt.→
  2. 2The result is always a stringEven if they type 123, you get the text "123".→
  3. 3Prohibited operationsWhy you can't do maths on the text input() gives you.→
  4. 4Type castingConvert between types with int(), float() and str().→
  5. 5String operators+ joins strings and * repeats them.→
  6. 6QuizCheck what you've learned about input and conversions.→