× Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Lesson 7 Lesson 8 Lesson 9 Lesson 10 Lesson 11 Lesson 12 Lesson 13 Lesson 14 Lesson 15 Lesson 16 Lesson 17 Lesson 18 Lesson 19 Lesson 20 Lesson 21 Lesson 22 Lesson 23 Lesson 24 Lesson 25 Mini Lesson 1 Mini Lesson 2 Mini Lesson 3 Mini Lesson 4 Mini Lesson 5


Mini Lesson 1: Multiple Variable Names

Welcome to a mini lesson, where I want to introduce a topic, but it is isn't large enough to consider a full lesson. Being able to assign multiple variable names can be useful in many situations. Let me start off with an example, using what we learned from input() and .split(). Say for example that you want to store the first and last name of someone using your program, and you want to be able to store their name as: 'last_name, first_name'. Using multiple variable names, this could be easily done:

first_name, last_name = input().split()

print(last_name, first_name)

This would output the aforementioned format, with the last name followed by the first name.