之所以选中 Python(蟒蛇) 作为程序的名字,是因为他是 BBC 电视剧——蒙提·派森的飞行马戏团(Monty Python’s Flying Circus)的爱好者。 python的为吉多·范罗苏姆(Guido van Rossum)。

python的基础操作
python的变量 input:输入您要输入的字符串 print:输出您输入的字符串


在Python中用if来进行判断的,格式如下:
我们可以把整个 if 语句看成一个完整的代码块

1.定义一个整数变量记录年龄
2.判断是否满 18 岁 (>=)
3.如果满 18 岁,允许进网吧嗨皮
注意:if和else语句以及各自的缩进部分共同是一个完整的代码块

while 语句时还有另外两个重要的命令 continue,break 来跳过循,continue 用于跳过该次循环,break 则是用于退出循环,此外"判断条件"还可以是个常值,表示循环必定成立,具体用法如下:
注意:while语句以及缩进部分是一个完整的代码块
#求1到100之间的和

后面的都不会了 , 就是这么尴尬
网友评论