There have wrong code.

- Code: Select all
`for I in range(10,1) :`

print(I)

There have an picture of program.

3 posts
• Page **1** of **1**

How to print 10 to 1 step by step? Please help me.

There have wrong code.

There have an picture of program.

There have wrong code.

- Code: Select all
`for I in range(10,1) :`

print(I)

There have an picture of program.

My Python Version is 3.2.3

- b849961@drdrb.com
**Posts:**13**Joined:**Thu Oct 24, 2013 12:41 pm

b849961@drdrb.com wrote:Please help me.

Please read documentation.

- Code: Select all
`Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win 32`

Type "help", "copyright", "credits" or "license" for more information.

>>> for I in range(10,1) :

... print(I)

...

>>> help(range)

Help on built-in function range in module __builtin__:

range(...)

range([start,] stop[, step]) -> list of integers

Return a list containing an arithmetic progression of integers.

range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.

When step is given, it specifies the increment (or decrement).

For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!

These are exactly the valid indices for a list of 4 elements.

>>> for I in range(3) :

... print(I)

...

1

2

>>> for I in range(3,1,-1) :

... print(I)

...

3

2

>>>

Due to the reasons discussed here we are moving to python-forum.net on October 1, 2016.

This forum will be closed. Please create an account at the new site to continue discussion.

IRC://irc.freenode.net/python-forum

This forum will be closed. Please create an account at the new site to continue discussion.

IRC://irc.freenode.net/python-forum

- Kebap
**Posts:**689**Joined:**Thu Apr 04, 2013 1:17 pm**Location:**Germany, Europe

Kebap wrote:b849961@drdrb.com wrote:Please help me.

Please read documentation.

- Code: Select all
`Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win 32`

Type "help", "copyright", "credits" or "license" for more information.

>>> for I in range(10,1) :

... print(I)

...

>>> help(range)

Help on built-in function range in module __builtin__:

range(...)

range([start,] stop[, step]) -> list of integers

Return a list containing an arithmetic progression of integers.

range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.

When step is given, it specifies the increment (or decrement).

For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!

These are exactly the valid indices for a list of 4 elements.

>>> for I in range(3) :

... print(I)

...

1

2

>>> for I in range(3,1,-1) :

... print(I)

...

3

2

>>>

Thank you Kebap. You are always in my heart.

My Python Version is 3.2.3

- b849961@drdrb.com
**Posts:**13**Joined:**Thu Oct 24, 2013 12:41 pm

3 posts
• Page **1** of **1**

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests