菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
195
0

20201224-1

原创
05/13 14:22
阅读数 39018
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

相关热门文章

发表评论

0/200
195 点赞
0 评论
收藏