Test1:Use the powershell to output the contents

 print "Hello World!"
print "Hello Again"
print "I like typing this."
print "This is fun."
print 'Yay! Printing.'
print "I'd much rather you 'not'."
print 'I "said" do not touch this.'

首先,我们要把上面这段代码通过文本编辑器(我用的是gedit,当然Windows自带的记事本也行)保存成.py的格式。

接着我们打开powershell,利用cd的命令打开你所保存的.py文件的文件夹,只有这样才能利用python来跑这段脚本。

最后我们在光标处输入python (文件名).py再回车即可运行以上python脚步了。

Running result:

PS C:\Users\Admin\desktop> python ex1.py
Hello World!
Hello Again
I like typing this.
This is fun.
Yay! Printing.
I'd much rather you 'not'.
I "said" do not touch this.

Other topic:

  1. 让你的脚本再多打印一行。
  2. 让你的脚本只打印一行。
  3. 在一行的起始位置放一个 ‘#’ (octothorpe) 符号。它的作用是什么?自己研究一下。

Let's solve the problems!

1:可以在当前的.py文件中修改源代码在代码末尾加入一行print “             ”,这样running的result就会变成多打印了一行(总觉得不应该这么傻瓜样的操作,看以后深入学习了再来修改这里吧)

2:只用一个print

3:这个我们可以自己加的试试running一下。结果出来我们很容易知道#号的功能是注释,在哪一行前面加上#,这一行的内容将不会被打印出来

至此,我们的习题一就结束了。

最新文章

  1. 实现手机扫描二维码页面登录,类似web微信-第四篇,服务器端
  2. 获取oracle 里的表名与字段
  3. ZOJ-3201 Tree of Tree 树形DP
  4. target vs currentTarget, clientWidth vs offsetWidth
  5. CMarkUp读写XML(转)
  6. Trafic
  7. 当向后台插入或读取JSON数据遇见回车时
  8. swoole 入门
  9. poj2793 素数和
  10. TGI
  11. OpenCV在C#中应用—OpenCVSharp
  12. [Objective-C] Copy 和 MutableCopy
  13. ubuntu16.04下安装opencv3.4.1及其扩展模块
  14. Linux Centos 7.4 内核升级
  15. NIO的Buffer&Channel&Selector
  16. 查看局域网其它电脑的计算机名和IP
  17. 理解C# 4 dynamic(4) – 让人惊艳的Clay(转)
  18. css常用属性总结:文本属性中的text-indent
  19. tomcat 控制台乱码问题
  20. 更新Mac双系统多分区

热门文章

  1. Python入门--13--递归
  2. eclipse软件安装及python工程建立
  3. 洛谷P1352 没有上司的舞会
  4. Java中Class.this和this的区别(转)
  5. [置顶] 内存管理一点也不神秘————手绘iOS内存管理细节
  6. JAVA_MyEclipse如何加载JDK JRE
  7. odoo写邮件添加收件人
  8. struts.xml中为什么加上<constant name="struts.devMode" value="true" />就出错
  9. 走入asp.net mvc不归路:[1]项目文件结构
  10. HDU 5335 Walk Out(多校)