DDR爱好者之家 Design By 杰米

python入门之语句,包括if语句、while语句、for语句,供python初学者参考。

//if语句例子
name = 'peirong';

if name == 'peirong':
 print 'this is peirong';
elif name== 'maojun':
 print 'this is maojun';
else:
 print 'others';

//while语句
i = 0;
a = range(10);
while i < a.__len__():
 print i;
 i = i+1;

//for语句
a = range(1,10);
for i in a:
 print i;
else:
 print 'The for loop is over!'

//continue 语句
a = range(1000)
for i in a:
  if i % 3 == 0:
    print 'chuyi 3 yu 0 ';
  elif i % 3 == 1:
    print 'chuyi 3 yu 1 ';
  else:
    continue

DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米