码迷,mamicode.com
首页 > 编程语言 > 详细

2019-06-11_Python循环语句

时间:2019-06-11 14:53:44      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:命令   print   target   打印   blank   break   bre   its   www   

# coding=utf-8
# !/usr/bin/python

# 命令1
# count = 0
# while (count < 9):
# print ‘The count is:‘, count
# count = count + 1
# print "Good bye!"


# 命令2
#!/usr/bin/python
# -*- coding: UTF-8 -*-

# for letter in ‘Python‘: # 第一个实例
# print ‘当前字母 :‘, letter
#
# fruits = [‘banana‘, ‘apple‘, ‘mango‘]
# for fruit in fruits: # 第二个实例
# print ‘当前字母 :‘, fruit
#
# print "Good bye!"

# 命令3

# i = 2
# while(i < 100):
# j = 2
# while(j <= (i/j)):
# if not(i%j): break
# j = j + 1
# if (j > i/j) : print i, " 是素数"
# i = i + 1
#
# print "Good bye!"

# 命令4:打印100以内的质数
# num=[];
# i=2
# for i in range(2,100):
# j=2
# for j in range(2,i):
# if(i%j==0):
# break
# else:
# num.append(i)
# print(num)

# 命令5:实现金字塔的效果
#*字塔
# i=1
# #j=1
# while i<=9:
# if i<=5:
# print ("*"*i)
#
# elif i<=9 :
# j=i-2*(i-5)
# print("*"*j)
# i+=1
# else :
# print("")

链接地址:https://www.w3cschool.cn/python/python-nested-loops.html

2019-06-11_Python循环语句

标签:命令   print   target   打印   blank   break   bre   its   www   

原文地址:https://www.cnblogs.com/wbly2019/p/11003385.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!