1
0
Files
pythonCrashCourse/chap3/cars.py

22 lines
383 B
Python
Raw Normal View History

2025-05-09 10:12:44 -04:00
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)