Python for Beginners
Guided lesson · 9 minutes

2. Store values and work with text

Work through the guide, keep private notes, and mark this lesson complete when you’re ready.

01

Store information in a variable

A variable gives a value a useful name. For example, learner_name = "Amina" stores text, while minutes = 15 stores a whole number. Choose names that explain what the value represents.

02

Work with text and numbers

Text values are strings and use quotation marks. Numbers can be used in calculations. Convert a text entry to a number before calculating with it, and check inputs because a user may provide something unexpected.

03

Try it

Store the name of a course and the minutes spent studying in separate variables. Print a sentence that includes both values. Change the minutes and confirm the output reflects the change.

Key takeaways

  • Variables give values meaningful names.
  • Text and numeric values behave differently.
  • Check and convert user input before calculating.
Enroll in this course to save lesson progress.View course