22 lines
383 B
Python
22 lines
383 B
Python
|
|
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)
|