Lesson 1 of 10
Your first program
- 8 min
- 5 checks
- 3 hints
- Go to task
Goal
Variables, print and f-strings
Explanation
Python reads a lot like English. There are no semicolons at the end of lines, no curly braces around blocks, and you never state a variable's type: writing name = "Layan" is all it takes to create one.
The print() function shows whatever you give it on the screen, and the easiest way to put variable values inside text is an f-string: write the letter f before the opening quote and put each variable inside curly braces.
For example, you write f"My name is {name}" instead of gluing strings together yourself or converting numbers to text.
Your task
Define a variable name holding a string and a variable age holding a whole number, then print a single sentence that includes both.
Checks
5 checks- name is a non-empty string
- age is a whole number, not a string
- The name was printed
- The age was printed
- Name and age are on the same line