Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8466145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:15:20+00:00 2026-06-10T15:15:20+00:00

I am writing a program in which it needs to determine the range of

  • 0

I am writing a program in which it needs to determine the range of the number as if I put 15 in user_input ‘a’ so it should print range from ‘a’ to ‘b’ but unfortunately i’m unable to work it out can anyone please help me with this. This is my code:

a = int(raw_input("How many did you say you're going to count down? "))
b = int(raw_input("When are you actually going to stop? "))
i = 0
for i in range(a, b):
    i = i + 1
    print i 

and I want it to work like this:

How many did you say you're going to count down? 15
When are you actually going to stop? 8
15
14
13
12
11
10
9
8

OR

How many did you say you're going to count down? 6
When are you actually going to stop? 4
6
5
4
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:15:22+00:00Added an answer on June 10, 2026 at 3:15 pm

    The loop can be:

    a = int(raw_input("How many did you say you're going to count down? "))
    b = int(raw_input("When are you actually going to stop? "))
    
    for i in range(a, b-1, -1):
        print i 
    

    (assuming the count decreases).

    What you must know is:

    1. The for loop does the decrement for you (no need for i = i-1 like in C).
    2. range(a, b-1, -1) is a list (in Python 2) that goes from a to b-1 (not included), by steps of -1. You can try to do, in a Python shell, print range(10, 5, -1), for instance. You can also check the output of range(5, 11, 2), to understand better what range() does.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a program which needs to be run in Android 2.0. I
I am writing a program which needs to access data in a web server.
I'm writing a C++ program which needs to be able to read a complex
I am writing a program which collects lots of individual pieces of data from
I'm writing a program which needs to traverse a set of directories. Tried to
I am writing a C program which needs to send back a HTTP Bad
I am writing a program which needs communication between processes. my code: #lang racket
I am writing a small program which needs to create a new file with
A Python program I'm writing is to read a set number of lines from
I'm writing a program which will need to do a very large number of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.