python--以1-31的数字作为结尾的列表?论英文好的重要性!
一、python基础教程第2板(修订版)【代码清单2-1】中有一段要求打印‘以1-31的数字作为结尾的列表’
截取代码示例:endings =['st','nd','rd'] +17*['th'] + ['st','nd','rd'] +7*['th'] +['st']
运行结果:print(endings)
['st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st']
注:以上测试结果在Pycharm完成
二、刚一开始疑虑为何列表可以那样写?稍加揣摩并Baidu了下,原来是英文的1-31天的英文末尾字符的简写,其中1-31天的英文对照如下:
first (1st)
second (2nd)
third (3rd)
fourth (4th)
fifth (5th)
sixth (6th)
seventh (7th)
eighth (8th)
ninth (9th)
tenth (10th)
eleventh (11th)
twelfth (12th)
thirteenth (13th)
fourteenth (14th)
fifteenth (15th)
sixteenth (16th)
seventeenth (17th)
eighteenth (18th)
nineteenth (19th)
twentith(20th)
twenty-first(21st)
twenty-second(22nd)
twenty-third(23rd)
twenty-fourth(24th)
twenty-fifth(25th)
twenty-sixth(26th)
twenty-seventh(27th)
twenty-eighth(28th)
twenty-ninth(29th)
thirtith(30th)
thirty-first(31st)
三、由此可以看出英语在日常编码和学习的重要性,坚持编码的过程也要坚持学习English!
python--以1-31的数字作为结尾的列表?论英文好的重要性!的更多相关文章
- python基础之数据类型之数字、字符串、列表
数据类型及内置方法 一.数字类型 整数型(int) 1.用途:年龄,号码等 2.定义:age = 10 age = int(10) x = int(’11’) int只能转换纯数字的字符串 3 ...
- python基础之数字、字符串、列表、元组、字典
Python基础二: 1.运算符: 判断某个东西是否在某个东西里面包含: in 为真 not in 为假 (1).算术运算符: 运算符 描述 实例 + 加 表示两个对象相加 a + b输出结果3 ...
- Python数据类型深入学习之数字
一. 数字常量 1. 下面来看看Python的数字常量中都要哪些类型: 数字 常量 129,-89,0 一般整数 9999848499999L,4594646469l 长整型数(无限大小) 1.232 ...
- Python基础(10)--数字
本文的主题是 Python 中的数字.会详细介绍每一种数字类型,它们适用的各种运算符, 以及用于处理数字的内建函数.在文章的末尾, 简单介绍了几个标准库中用于处理数字的模块. 本文地址:http:// ...
- js正则表达式,判断字符串是否以数字组结尾,并取出结尾的数字
js正则表达式,判断字符串是否以数字组结尾,并取出结尾的数字 <!DOCTYPE html> <html> <head> <meta charset=&quo ...
- python中输入多个数字(代码实现)
不多说,直接上代码: list1 = [] #定义一个空列表 str1 = input("请输入数值,用空格隔开:") # list2 = str1.split(" &q ...
- 4. Python数据类型之数字、字符串、列表
开发过程中,我们需要处理文本.图形.音频.视频.网页等各种各样的数据,不同的数据,需要定义不同的数据类型.在Python中,能够直接处理的数据类型主要有以下几种:数字.字符串.列表.元组.字典.集合等 ...
- python学习1-字符串数字基本运算以及if条件和while循环
python学习1-字符串数字基本运算以及if条件和while循环 字符串表达形式共四种: name = "string" name = 'string' name = " ...
- Python魔法缓存,以数字开始
Python魔法缓存,以数字开始 众所周知,Python是弱类型的脚本语言,变量的定义是不用声明类型的. a = 1 Python所有数字的本质都是对象, 他们是不可改变的数据类型,这意味着改变数字数 ...
随机推荐
- spring boot 参数转换
参数调用方式: 1. localhost:8080/person/properties/to/json body参数设置: 2. localhost:8080/person/json/to/prope ...
- SocLib的安装
一.soclib的安装 1.安装g++,一般Ubuntu系统都自带了,所以无需安装.后面这两个软件需要提前安装,不然后面执行相关操作是会报错:sudo apt-get install automake ...
- Jenkins+Gitlab+Ansible自动化部署(三)
接Jenkins+Gitlab+Ansible自动化部署(一)https://www.cnblogs.com/zd520pyx1314/p/10210727.html 和(二)https://www. ...
- winform 程序隐藏窗口运行
DWPublishForm frm = new DWPublishForm(); frm.IsAutoUpdate = true; frm.ShowInTaskbar = false; frm.For ...
- [USACO07JAN]平衡的阵容Balanced Lineup
[USACO07JAN]平衡的阵容Balanced Lineup 题目描述 For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) a ...
- js 回车提交表单
一.整个页面用一个回车提交事件: <input type="button" value="回车提交" id="auto" onclic ...
- 滚动条插件mCustomScrollbar
1. 参考网站 http://www.wufangbo.com/mcustomscrollbar/ 2. 使用方法
- 使用 h5 新特性,轻松监听任何 App 自带返回键
var hiddenProperty = 'hidden' in document ? 'hidden' : 'webkitHidden' in document ? 'webkitHidden' : ...
- CSS3学习-用CSS制作立体导航栏
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- UIButton 图片文字位置
在实际开发过程中经常在按钮上添加文字和图片,位置和图片的位置根据需求放置也是不一样的.下面实现了各种显示方式,如下图: UIButton+LSAdditions.h // // UIButton+LS ...