initial file upload
This commit is contained in:
22
chap3/cars.py
Normal file
22
chap3/cars.py
Normal file
@@ -0,0 +1,22 @@
|
||||
cars = ['bmw', 'audi', 'toyota', 'subaru']
|
||||
cars.sort()
|
||||
print(cars)
|
||||
|
||||
cars.sort(reverse=True)
|
||||
print(cars)
|
||||
|
||||
cars = ['bmw', 'audi', 'toyota', 'subaru']
|
||||
print("\nHere is the original list:")
|
||||
print(cars)
|
||||
|
||||
print("\nHere is the sorted list:")
|
||||
print(sorted(cars))
|
||||
|
||||
print("\nHere is the original list again:")
|
||||
print(cars)
|
||||
|
||||
cars.reverse()
|
||||
print(cars)
|
||||
|
||||
length_cars = len(cars)
|
||||
print(length_cars)
|
||||
Reference in New Issue
Block a user