摘要:
案例1:字符串 for i in 'python': print('当前字母:',i) 案例2:列表 fruit = ['apple','banana','pear','orange']for i in fruit: print('水果:',i) 案例3:字典 sean = {'name':'app 阅读全文
posted @ 2020-07-19 23:19
sean_wang
阅读(205)
评论(0)
推荐(0)
摘要:
1. 使用while循环输出1 2 3 4 5 6 8 10count = 0while count < 10: count += 1 if count == 7 or count == 9: continue print(count)2.求1-100的所有数的和 num = 0count = 1w 阅读全文
posted @ 2020-07-19 21:55
sean_wang
阅读(259)
评论(0)
推荐(0)
摘要:
while 条件: 循环体 如果条件为真,那么循环体则执行,执行完毕后再次循环,重新判断条件。。。如果条件为假,那么循环体不执行,循环终止 1.奇偶数案例: 案例1 :打印1-10count = 1while count <= 10: print('数值:',count) count +=1案例2 阅读全文
posted @ 2020-07-19 20:54
sean_wang
阅读(378)
评论(0)
推荐(0)
摘要:
逻辑运算:即根据不同条件状态做出不同反应 案例1.:如果女人大于30岁,则称呼阿姨。 age_of_girl = 32 if age_of_girl > 30: print('阿姨好') 案例2:如果:女人的年龄>30岁,那么:叫阿姨,否则:叫小姐姐 age_of_girl = 29 if age_ 阅读全文
posted @ 2020-07-19 17:50
sean_wang
阅读(179)
评论(0)
推荐(0)

浙公网安备 33010602011771号