美文网首页
Python第二课---条件判断和循环

Python第二课---条件判断和循环

作者: 计算机视觉__掉队选手 | 来源:发表于2019-01-15 18:14 被阅读0次

if 语句

1.语法

if True:
    print("hello world")
if True:
    print("hello world")
else:
    print("I hate the world")
if 2>1:
    print("1")
elif 2<3"
    print("2")
else:
   print("finish")

循环语句

while 循环

语法

while True:
    print("hello world")

for 循环

语法

for i in range(3):
    print(i)
0
1
2

相关文章

网友评论

      本文标题:Python第二课---条件判断和循环

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