20201224-1

1-1
#
bicycles.py bicycles = ['trek', 'cannondale', 'redline', 'specialized'] message = "My first bicycle was a " + bicycles[0].title() + "." print(message)
--->
My first bicycle was a Trek.
1-2
# cars.py

cars = ['bmw', 'audi', 'toyota', 'subaru']

print("Here is the original list:")
print(cars)

print("\nHere is the sorted list:")
print(sorted(cars))

print("\nHere is the reverse alphabetical list:")
print(sorted(cars, reverse=True))

print("\nHere is the original list again:")
print(cars)
1-3
# motorcycles
motorcycles = ['honda', 'yamaha', 'suzuki', 'ducati'] 
print(motorcycles)

too_expensive = 'ducati'
motorcycles.remove(too_expensive)
print(motorcycles)
print("\nA " + too_expensive.title() + " is too expensive for me.")

注:知识点链接 

https://www.cnblogs.com/azxsdcv/p/14183819.html

https://www.cnblogs.com/azxsdcv/p/14183874.html

posted @ 2020-12-24 14:09  Malakh  阅读(54)  评论(0编辑  收藏  举报