Variables and typesvariables-intro
LessonΒ·difficulty 1/5Β·~8 min
Variables: storing values
Variables
A variable is a name that points at a value. You make one with =:
python
age = 30
name = "Ada"
is_admin = False
Python figures out the type (integer, string, boolean, β¦) from the value on the right.
Your task
Create three variables:
nameβ your display name as a stringageβ an integeris_studentβ a boolean (TrueorFalse)
Then build a single string called summary that says:
"<name> is <age> years old (student: <is_student>)"
Example output for name="Ada", age=27, is_student=False:
"Ada is 27 years old (student: False)"
You don't need to print anything β the test runner inspects summary
directly.
Tests
- summary is a string
- summary mentions the name
- summary mentions the age as a string
- summary mentions the is_student value (hidden)
Stuck? Ask for a spark
warming up
Loading editorβ¦
$ Console output will appear here.