设为首页收藏本站

Crossin的编程教室

 找回密码
 立即加入
楼主: iamocean
打印 上一主题 下一主题

【Python 第10课】 变量2

[复制链接]

0

主题

0

好友

48

积分

新手上路

Rank: 1

楼主
发表于 2015-5-12 08:59:18 |显示全部楼层
a = 0
b =0

while a <99:
    b = b+a
    a = a+1
   
while a<100:
    b = b+a
    a = a+1

    print a
    print b
输出最终结果
回复

使用道具 举报

0

主题

0

好友

48

积分

新手上路

Rank: 1

沙发
发表于 2015-5-12 10:09:49 |显示全部楼层
#learning in crossin
#while To circulate everything,under while  
a = 0
b =0  #the prerequisite to determine the sentence below

while a <99:
    a = a+1
    b = b+a
while a<100:
    a = a+1
    b = b+a
    print a
    print b
12课发现上面做错 while 下b结果放到a结果后面才能用a新赋值
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

QQ|手机版|Archiver|Crossin的编程教室 ( 苏ICP备15063769号  

GMT+8, 2024-5-2 20:19 , Processed in 0.024155 second(s), 22 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部