motorcycle = ["honda", "yamaha", "suzuki"]

last_owned = motorcycle.pop()
print("The last motorcycle I owned was a " + last_owned.title() + ".")

输出为:

The last motorcycle I owned was a Suzuki.

Python自学:第三章 使用方法pop()删除元素的更多相关文章

  1. Python自学:第三章 使用del语句删除元素

    motorcycles = ["honda", "yamaha", "suzuki"] print(motorcycles) del mot ...

  2. Python自学:第三章 使用方法sort( )对列表进行永久性排序

    cars = ["bmw", "audi", "toyota", "subaru"] cars.sort() print ...

  3. Python自学:第三章 弹出列表中任何位置处的元素

    motorcycles = ["honda", "yamaha", "suzuki"] first_owned = motorcycles. ...

  4. Python自学:第三章 确定列表长度

    >>> cars = ["bmw", "audi", "toyota", "subaru"] > ...

  5. Python自学:第三章 倒着打印列表

    # -*- coding: GBK -*- #reverse: 相反的 cars = ["bmw", "audi", "toyota", & ...

  6. Python自学:第三章 使用函数sort( )对列表进行临时排序

    # -*- coding: GBK -*- cars = ["bmw", "audi", "toyota", "subaru&qu ...

  7. Python自学:第三章 动手试一试 3-4、3-5

    # -*- coding: GBK -*- liebiao = ["zhang", "li", "wang", "zhou&quo ...

  8. Python自学:第三章 根据值删除元素

    motorcycles = ["honda", "yamaha", "suzuki", "ducati"] print( ...

  9. Python自学:第三章 在列表末尾添加元素与在列表中插入元素

    motorcycles = ['honda', 'yamaha' ,'suzuki'] motorcycles.insert(0, "ducati") print(motorcyc ...

随机推荐

  1. 我的第三篇博客(激动激动真激动!!!)A-B Problem

    #210. 差(A-B problem) 题目描述 楠楠在网上刷题,感觉第一题:求两数的和(A+B Problem)太无聊了,于是增加了一题:A-B Problem,难倒了一群小朋友,哈哈. 题目是这 ...

  2. Qt QSpinBox 和 QDoubleSpinBox

    展示一个效果: QDoubleSpinBox跟QSpinBox类似,只是多了一个decimal.

  3. Qt QLineEdit 漂亮的搜索框 && 密码模式 && 格式化输入 && 提示文字 && 选择内容并移动 && 清除全部输入

    先上一个漂亮的搜索框效果图, 输入搜索文本效果, 点击搜索图标效果: //实现代码 void MainWindow::iniLineEdit() { ui->lineEdit->setPl ...

  4. 关于信号打断正在读取终端的read与select来监视0文件描述符的问题

    首先说一下对于这个问题外的一些话: 我觉得我们应该有种质疑的态度,因为接下来的这个问题就和我们平常所想的不一样. 介绍一下问题: 曾经一直听说信号可以打断一个正在阻塞的进程,但是今天我试了一下关于信号 ...

  5. ASP.Net Core "The type initializer for 'Gdip' threw an exception"

    ASP.NET Core项目部署在Linux下可能会出现GDI错误 The type initializer for 'Gdip' threw an exception 解决方案:创建 libdl 的 ...

  6. springmvc 配置之 mvc:default-servlet-handler

    配置dispatchServlet的方法一般是: <servlet> <servlet-name>mvc-servlet</servlet-name> <se ...

  7. oracle使用 extract获取当前时间,并比较两个时间

    --根据当前时间戳获取年月日时分秒,其中sysdate不能用于获取时分秒select systimestamp, extract(year from systimestamp) year ,extra ...

  8. iOS项目之使用开关控制日志输出的功能

    最近一直在做sdk的项目,用户提出了一个需求,需要屏蔽sdk内部的日志输出.由于sdk内部的日志是为了调试,如果屏蔽了肯定不方便,所以研究了一下日志输出开关的功能. 在这里介绍两种实现方案:一种方案是 ...

  9. php 使用代理IP进行数据抓取

    什么是代理?什么情况下会用到代理IP?代理服务器(Proxy Server),其功能就是代用户去取得网络信息,然后返回给用户.形象的说:它是网络信息的中转站.通过代理IP访问目标站,可以隐藏用户的真实 ...

  10. knative

    office Doc Knative 简介 Install sevice example (knative) There is only one node in the cluster so we u ...