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
- Set
nameto your name (any non-empty text in quotes). - Build a variable
introthat joins the text"Hi, my name is "withname, using+.
python
name = "Sam"
intro = "Hi, my name is " + name
print(intro) # Hi, my name is Sam
Mind the space after
isinside the quotes β without it you'd getHi, 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.