Let's take a look at for structure ：

```#!/usr/bin/python
# -*- Coding:UTF-8 -*-
for i in range(1):
print i```

Output ：

`0`

Input and output ：

```#!/usr/bin/python
# -*- Coding:UTF-8 -*-
for i in range(1, 10):
print i
# Output : 1 2 3 4 5 6 7 8 9```

Input and output ：

```#!/usr/bin/python
# -*- Coding:UTF-8 -*-
for i in range(1, 10, 2):
print i,
# Output ：1 3 5 7 9```

summary ：

range([start=0], stop, [step=1]) The meaning of function ：

1, from start Start , To stop end , Step length is step;

2, If range There is only one parameter , So from 0 Start to stop-1 end ;

3,step The default step size is 1, Can be rewritten as 2 Or more ;

4, Starting point contains start, The destination does not contain stop, To stop-1 end （start <= i < stop）

## 【python】 Understand the cycle ：for,while More articles about

1. Python The cycle of the correct operation of the use of detailed

To calculate 1+2+3, We can write expressions directly : >>> 1 + 2 + 3 6 To calculate 1+2+3+...+10, Barely able to write . however , To calculate 1+2+3+...+10000, Just write the expression ...

2. Python The cycle of

Circulation is a structure , Cause a program to repeat a certain number of times So is the conditional cycle , When the condition becomes false , The loop ends For loop stay python for Loop through the sequence , Like a list or a character . for Cyclic grammar :   ——for iter ...

3. python Basics - loop

loop loop To calculate 1+2+3, We can write expressions directly : >>> 1 + 2 + 3 6 To calculate 1+2+3+...+10, Barely able to write . however , To calculate 1+2+3+...+10000, straight ...

4. python The cycle and choice of

One .python The structure of choice : python There are two kinds of selection structures in the structure of selection, one is single selection (if...else) The other is multiple choice structure (if ...elif...elif) Here's how to do it in code : 1.if....el ...

5. stay oj in Python The problem of cyclic input is solved

stay oj in Python The problem of cyclic input is solved stay makefile Comma string and space string are defined in stay linux Deploy on the server javaweb project jar package Data structure and algorithm stack (Java And Python Realization ) stay oj in ...

6. python And Loop statement

python Provides for Circulation and while Loops and nested loops ( stay python There is no do..while loop ) while Cyclic grammar : while Judge the condition : Execute statement ...... Actual case : numbers ...

7. Python while Examples of recycling

while The cycle is in Python One of the cyclic structures in . while The cycle continues , Until the expression becomes false . It's a logical expression , Must return a true or false value , This article introduces Python while Recycling side ...

8. Python Study -7.Python The loop statement of -for sentence

Python Middle loop can be used for Statement to implement list = ['Tom','Lucy','Mary'] for name in list: print(name) It will output in turn Tom Lucy Mar ...

9. Python for Loop statement

Python for Loop statement Python for Loop can traverse any sequence of items , Like a list or a string . grammar : for The syntax of the loop is as follows : for iterating_var in sequenc ...

10. python for Loops and common functions

python for loop Format : for iterating_var in sequence: statements(s) ###################################### ...

## Random recommendation

1. Invert the words in a sentence , Punctuation is not reversed . For example, will “I come from Shanghai.” It turns into “Shanghai. from come I”

string str = "I come from Shanghai."; // Cut according to the space string[] strS = str.Split(' '); string temp ...

2. Python Introduction to interactive programming ---- Event driven programming

Traditional programming is linear as follows : Start ---> Code block A---> Code block B---> Code block C---> Code block D--->......---> end Every block of code does all sorts of things ...

3. Holographic glasses HoloLens It can capture real people quickly 3D Images

http://www.d9soft.com/zixun/62287.html Beijing time. 3 month 28 Noon news , Microsoft R & D has developed a new 3D Video capture system “Holoportation”, It can be realized that someone 3D chart ...

4. [Effective JavaScript note ] The first 63 strip ： Be careful to discard mistakes

One of the ways to manage asynchronous programming is error handling . In synchronization code, just use try Statement blocks wrap a piece of code, and it's easy to deal with all the errors at once . try{ f(); g(); h(); } catch(e){ // It's used to make mistakes } t ...

5. webrtc - web Application related websites

Interesting website  http://io13webrtc.appspot.com/#1 html5 Use webrtc brief introduction  http://www.html5rocks.com/en/tutorials/getu ...

6. About webpack The best documentation

These days study webpack Packaging tools , I searched countless materials on the Internet , Good and evil people mixed up . Read dozens of materials , There is still no complete description of . It's been a long time , Or give up treatment . Back to the official website , Reading word by word , It took an hour to fully understand . Learning new ...

7. VS IDE in Visual C++ Project property configuration in

VS IDE in Visual C++ Project property configuration in One . Visual C++ The project system is based on MSBuild. Although you can edit it directly on the command line XML Project files and property sheets , We still recommend that you use VS IDE ...

8. MIT Comments on the role of mathematics in machine learning

MIT Comments on the role of mathematics in machine learning Reprinted from http://my.oschina.net/feedao/blog/52252, But this link is also reproduced , There is no way to verify the source .   It seems that mathematics is always not ...

9. Windows server Self contained .net edition

1. Win2012r2 The version with it : 2. Win2016 The version with it 4.6 Win2019 Self contained .net Version is : 4.7 4. Then compare Win2008r2sp1 It uses .net3.5 ...

10. [HNOI2008] Prison break Answer key （ Principle of tolerance and exclusion + Fast power ）

[HNOI2008] Prison break Description The prison has a serial number of 1...N Of N A room , One prisoner in each room , Yes M Religion , Every prisoner may believe in one of them . If the prisoners in the adjacent rooms share the same religion , There could be a prison break , Ask for more ...