Your First Python Test
Now you have the chance to test Python and Learn by yourself. In the editor at the right 👉 you'll see some Python code.
In the first line (
your_name = "") we're defining a variable named
your_name which was assigned an "empty string". It's just blank/empty text. Go ahead and put your name in it. In my case, I'll have:
your_name = "Santiago".
The next variable defined is
course. This has the value
"Intro to Python" which represents this course.
We then define the variable
greeting_message, which looks a little bit more complicated. This variable is using String formatting to merge a "template string" with some values. Don't worry too much about it, we'll learn about it in depth in the future. For now, what you have to know is that we're combining the "fixed" (template-like) text parts like
"to the" and
"course" with "dynamic" values contained in our variables
course. The final result of the
greeting_message variable will be (for my name):
"Welcome Santiago to the Intro to Python course!".
Finally, we're printing that message in the screen with the function
And you'll see the output:
Finally, try submitting your solution to see our "tests" pass.
test name is not blank - Run Test
def test_name_is_not_blank(): assert your_name != ''