美文网首页
今天遇到的问题

今天遇到的问题

作者: takasuky | 来源:发表于2015-11-10 21:09 被阅读65次

作为一个新手村村民,今天开始踏出coding的第一步,记录一下今天碰到的几个问题。

首先本人环境和工具:win10    python3.5    notepad++。

print

网络上教程:

print “xxx”

实际会出现如下报错:

File "E:\mypython\test", line 1

print "xxx"

SyntaxError: invalid syntax

修正为:print ('xxx')即可,或改‘’为“”

PS:同一语句中,不能重复用“”或‘’

即:

print ("i"said" do not touch this")

总结:除数字运算外,print的内容都需要加()并带 “”或‘’。

另外附上几个简单的小作业

1:(练习print的格式和敲字)

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.')

改为一行显示:(print多个字串)

print ("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')

2:(了解#注释)

print ('i could have code like this.') # and the comment after is ignored

# you can also use a comment to "disable" or comment out a piece of code:

#print ("this won't run.")

print ("this will run.")

3:(运用#注释,理解整个小程序的意思)

print ("i will now count my chickens:")

# 计算母鸡和公鸡的数量

print ("hens", 25 + 30 / 6)

print ("roosters", 100 - 25 * 3 % 4)

# 计算鸡蛋的数量

print ("now i will count my eggs:")

# 计算下列式子

print ( 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6)

# 判断:3+2是否小于5-7

print ("is it true that 3 + 2 < 5 - 7?")

# 运算并判断

print (3 + 2 < 5 - 7)

print ("what is 3 + 2?", 3 + 2)

print ("what is 5 - 7?", 5 - 7)

# 输出结果

print ("oh!that is why it's false.")

# 更多练习

print ("how about some more?")

# 判断真伪

print ("is it greater?", 5 > -2)

print ("is it greater or equal?", 5 >= -2)

print ("is it less or euqal?", 5<= -2)

以上是今天的问题记录。

相关文章

  • 今天遇到的问题

    1 对需求的细节抠的太多 忘记了最重要的东西 2 对客服的工作理解不够,还有很多细节末梢没有搞明白 3 原型图画的...

  • 今天遇到的问题

    作为一个新手村村民,今天开始踏出coding的第一步,记录一下今天碰到的几个问题。 首先本人环境和工具:win10...

  • 反思:今天遇到的问题

    1.小必写字慢 锻炼,多些,提醒与鼓励相结合,达到“但手熟”的程度。 2.孩子作业没完成,被拍照了 有我的原因,请...

  • 今天遇到的office问题

    去除页眉的横线方法 今天单位里有个护士长打个电话说他有个文档头上有一个横线很讨厌,每页都有去又去不掉,请我帮忙。我...

  • 今天写作遇到的问题

    本想着今天写一个故事一千多字搞定,写着写着随着故事的深入一看不对劲,这个故事没三千字以上写不完,估计今天完...

  • Flutter开发 - 今天遇到的问题

    问题1 VSCode在安卓模拟器或者真机上调试问题 问题 运行flutter,安卓模拟器连接成功,但是一直卡“ R...

  • 今天遇到的一些问题

    TextView 的上下留白问题 今天在对照 ue 图做 ui 时才发现,TextView 默认上下有一个 pad...

  • 今天遇到的问题与解决方法

    今天在运行代码的时候显示3000端口被占用,解决方法如下:查看占用端口的pid,然后kill 在使用superag...

  • [[UIApplication sharedApplicatio

    开发遇到的问题 今天遇到特别坑的问题,[[UIApplication sharedApplication] key...

  • 今天遇到的坑(屏幕适配问题,UIAlertView问题),以及s

    屏幕适配问题 在做EyptBeacon项目时,在storyboard中使用AutoLayout和SizeClass...

网友评论

      本文标题:今天遇到的问题

      本文链接:https://www.haomeiwen.com/subject/oyjhhttx.html