Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge 2: Sorting Lists | Lists, Loops And Functions
Python: For Beginners
Section 2. Chapter 2
single

single

Challenge 2: Sorting Lists

Swipe to show menu

Look at the example below to understand how sorting works.

1234
numbers = [3, 1, 4, 1, 5] numbers.sort() print("sorted:", numbers) #prints the sorted list print('done')

Now let's move on to the task.

Task

Swipe to start coding

Fill the array you were given with cities you like.

  • create a variable called cities;
  • add at least 3 cities to it;
  • print the result;

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt