YouTip LogoYouTip

Python Exercise Example74

# Python2.x Python Exercise Instance 74 [![Image 3: Python 100 Examples](#) Python 100 Examples](#) **Title:** List sorting and concatenation. **Program Analysis:** Sorting can use the sort() method, and concatenation can use the + operator or the extend() method. Program source code: ## Instance ```python #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == ' __main__ ': a = [1,3,2] b = [3,4,5] a.sort() # Sort list a print a # Concatenate lists a and b print a+b # Concatenate lists a and b a.extend(b) print a [1, 2, 3] [1, 2, 3, 3, 4, 5] [1, 2, 3, 3, 4, 5] [![Image 4: Python 100 Examples](http://www.runo
← Python Exercise Example75Python Exercise Example73 β†’