diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2019-07-28 19:56:32 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2019-07-28 19:56:32 +0800 |
commit | ae9568a5dd7fa45c2ea00e73214cffa089f017fa (patch) | |
tree | a4d3cdaa90c67feb9bbf485d290aca647912eaf6 /LectureNotesOnPython.rst | |
parent | 96118581cd123cf86726cdb47ad98ed368a27603 (diff) |
LectureNotesOnPython.rst: 移动boris johnson练习的位置
Diffstat (limited to 'LectureNotesOnPython.rst')
-rw-r--r-- | LectureNotesOnPython.rst | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/LectureNotesOnPython.rst b/LectureNotesOnPython.rst index e6649f1..d281755 100644 --- a/LectureNotesOnPython.rst +++ b/LectureNotesOnPython.rst @@ -425,6 +425,14 @@ a是变量名。 'a'是值。 a = 'a' 这个语句要从右边向左边读, 这很正常。 编程要达到一定的代码量, 才能渐渐感觉清晰。 你的第一个目标是100行代码, 实现这个目标后下一个目标是500行代码, 当你的代码量超过1000行时, 很多问题会渐渐清晰。 出错也很正常, 认识到错误的原因, 把错误改正了, 就等于进步了。 +**练习** 把下面这段文字转成字符串并存在变量boris中。 + +Boris Johnson, Prime Minister of the United Kingdom. Alexander Boris de Pfeffel Johnson is a British politician serving as Prime Minister of the United Kingdom and Leader of the Conservative Party since July 2019. He has been the Member of Parliament for Uxbridge and South Ruislip since 2015 and was the MP for Henley from 2001 to 2008. He also served as Mayor of London from 2008 to 2016 and Foreign Secretary from 2016 to 2018. Johnson identifies as a one-nation conservative and has been associated with both economically and socially liberal policies. + +将本段文本中所有字符转成大写字母。 JOHNSON共出现了几次? 这段文本中共有多少字符? 其中标点符号占了几个字符? 空格占了几个字符? + + + **练习** 以脚本模式运行下面的程序, 查看输出结果。 脚本模式即把下面的代码存在文件fruit.py中, 然后在命令行运行python fruit.py。 @@ -462,16 +470,6 @@ fruit中有多少apple? 有多少banana? 有多少orange? 数的时候你 - - -**练习** 把下面这段文字转成字符串并存在变量boris中。 - -Boris Johnson, Prime Minister of the United Kingdom. Alexander Boris de Pfeffel Johnson is a British politician serving as Prime Minister of the United Kingdom and Leader of the Conservative Party since July 2019. He has been the Member of Parliament for Uxbridge and South Ruislip since 2015 and was the MP for Henley from 2001 to 2008. He also served as Mayor of London from 2008 to 2016 and Foreign Secretary from 2016 to 2018. Johnson identifies as a one-nation conservative and has been associated with both economically and socially liberal policies. - -将本段文本中所有字符转成大写字母。 JOHNSON共出现了几次? 这段文本中共有多少字符? 其中标点符号占了几个字符? 空格占了几个字符? - - - 最简单的类定义 ------------------------------------ |