Challenge: Embed a Variable in a String
Test yourself and implement what you have learned so far.
We'll cover the following
Problem statement
You are given two variables, name
and age
, which store a person’s name and age respectively. You have to embed name
and age
in a larger string and print the final string.
Input
The input is the variables name
and age
.
Output
The output will be the final string in which you will embed name
and age
.
Sample input
"Ben", 18
Sample output
"Ben is 18 years old."
Test yourself
Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck!
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy