Task
In this challenge, you were provided two variables and you had to embed them in a string.
Solution
The first thing you had to figure out was that string interpolation can be used to embed variables into strings.
Next, you needed to write the required string in a print statement. To embed name
and age
in the string you had to insert a $
followed by the variable name at the location where you wanted to embed the variables.
print("$name is $age years old.");
You can find the complete solution below:
You were required to write the code given on line 5.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy