分享兴趣,传播快乐,增长见闻,留下美好!
亲爱的您,这里是LearningYard新学苑。
今天小编为大家带来“Python入门指南”,欢迎您的访问。
Share interest, spread happiness, increase knowledge, and leave beautiful.
Dear, this is the LearingYard Academy!
Today, the editor brings the Getting Started with Python,welcome to visit!
?
一、for循环的基础语句
for循环的基本格式为:for 临时变量 in 待处理数据:。该循环为历遍循环,可以理解为从待处理数据中逐一提取元素,让每个元素去执行一次内部的语句块。例如,字符串提取出来的元素就是字符,让字符去执行一次指令。
The basic format of a for loop is: for temporary variable in Pending data:. The loop is a traversal loop, which can be understood as extracting elements from the data to be processed one by one, and making each element execute an internal statement block once. For example, the element extracted from the string is the character, and the character is allowed to execute the instruction once.
二、range语句
range是一组数字序列。range(num)是一组从0到num(不含num)的整数序列,如range(4),即{0,1,2,3};range(num1,num2)是一组从num1到num2(不含num)的整数序列,如range(2,5),即{2,3,4};range(num1,num2,step)是一组从num1开始,到num2结束(不含num2),相差为step的整数序列,如range(5,10,2),即{5,7,9}。
range is a sequence of numbers. range (num) is a sequence of integers from 0 to num (without num), such as range (4), which is {0, 1, 2, 3}; range (num1, num2) is a sequence of integers from num1 to num2 (without num), such as range (2,5), {2,3,4}; range (num1, num2, step) is a sequence of integers starting at num1 and ending at num2 (excluding num2) with a difference of step, such as range (5,10,2), {5,7,9}.
今天的分享就到这里了,
如果您对文章有独特的想法,
欢迎给我们留言。
让我们相约明天,
祝您今天过得开心快乐!
That's all for today's sharing.
If you have a unique idea about the article,
please leave us a message,
and let us meet tomorrow.
I wish you a nice day!
参考资料
翻译:网易有道翻译
本文由LearningYard学苑整理并发出,如有侵权请后台留言沟通.
文案|Dongyang
排版|Dongyang
审核|hong
Learning Yard 新学苑