← Practice
πŸ“– Your first programsay-your-name
LessonΒ·difficulty 1/5Β·~6 min

Say your name

Say your name

Text in Python is called a string. You can glue strings together with + to build a bigger sentence:

python
food = "samosa"
sentence = "I love " + food
print(sentence)   # I love samosa

Your task

  1. Set name to your name (any non-empty text in quotes).
  2. Build a variable intro that joins the text "Hi, my name is " with name, using +.
python
name = "Sam"
intro = "Hi, my name is " + name
print(intro)   # Hi, my name is Sam

Mind the space after is inside the quotes β€” without it you'd get Hi, my name isSam. Strings join exactly as written.

Tests

  • you picked a name
  • intro starts with the greeting
  • intro is the greeting joined with your name (hidden)

✦ Stuck? Ask for a spark

warming up
Loading editor…

$ Console output will appear here.

>_AI tutor
Sign in to chat with the tutor.