Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Quick recap
6. Joining strings
Indexing and slicing
Summary

Instruction

Well done. To join a few strings, you can use the plus sign:

greeting = 'Hello, ' + user_name + '!'

You can also join strings with other variable types (such as integers) using the str() function:

user_age = 28
user_name = 'John'
greeting = user_name + ', you are ' + str(user_age) + '!'

Exercise

Use a for loop with an integer counter to print the following ten lines:

1 little Indians
2 little Indians
...
10 little Indians

Stuck? Here's a hint!

Remember to use str(counter) before you join the integer value with a string.