Printing 10 to 1 step by step

A forum for general discussion of the Python programming language.

Printing 10 to 1 step by step

Postby b849961@drdrb.com » Fri Oct 25, 2013 1:03 pm

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

There have wrong code.
Code: Select all
for I in range(10,1) :
    print(I)


There have an picture of program.
Untitled.jpg
Untitled.jpg (91.96 KiB) Viewed 118 times
My Python Version is 3.2.3
b849961@drdrb.com
 
Posts: 13
Joined: Thu Oct 24, 2013 12:41 pm

Re: Printing 10 to 1 step by step

Postby Kebap » Fri Oct 25, 2013 1:07 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
>>>

Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 282
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: Printing 10 to 1 step by step

Postby b849961@drdrb.com » Fri Oct 25, 2013 1:13 pm

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


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest