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 7872927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:21:46+00:00 2026-06-03T02:21:46+00:00

I want to create a table with a specific array increments corresponding to that

  • 0

I want to create a table with a specific array increments corresponding to that specific time. for example:

n     sec
100    0.2
200    0.4
etc.. 

Y is number of tries of specific array, n is the array size, increment is specific increment

if sortfunction==1:
            i=0
            while i<y:
                dt=0
                for i in range(n):
                    i=i+increment
                    dt+=sort_timehelp(x,quick_sort)
                    output="%d %f\n" %(i,dt)
                    print output

for example if i put N as 1000 and increment 100, then it would look something like an above table.

right now i get:

n    sec
100  0.001
101  0.0012
102  0.0014

etc it goes by 1 not by the increment size

EDIT:
I got another question: why this does this while loop doesn’t go more times?

   i=0
   while i<y:
        i=i+1
        dt=0
        for i in xrange(increment, n+increment, increment):
                dt+=sort_timehelp(x, quick_sort)
                output="%d %f\n" %(i,dt)
                print output

i is the number of array tests.
Why it doesn’t go for example 2 times

Edit: Never mind I used for loop instead.
I have a last question.
What if I have a lot of those kinds of if statements only the difference is a sortfunction, then how can i save it all of that stuff to a file, since when I tried it will only save a last printed statement

#
 saving=input("You want to save data ? type 0 to continue or 1 to save " )
 if saving == 0:
        continue
 if saving == 1:
        ask=raw_input("Type the name file: ")
        fileout=open(ask+".csv","a")
        fileout.write(output)
        fileout.close()

the indentation of “saving” is the same as if sortfunction

  • 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-03T02:21:49+00:00Added an answer on June 3, 2026 at 2:21 am

    The range(n) function returns a list [0,1,2,…], which the for loop then iterates over. So when i is 0 and your do i=i+increment, your value of i (100) gets thrown away, and replaced with the next element of the list – i.e. 1.

    You can instead try for i in range(increment,n+increment,increment), and then delete the first line inside your for block. The range function itself will add increment every iteration of the loop – i.e. i will be 100,200,300,…,1000

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create specific table in PHPTAL. I have array like that: $tab
I want to create a new table and then insert a specific record in
i want to create a table of all the h tags for a specific
I want to create a table of friends with personal information and log on
I want to create a table like myTable = { [0] = { [a]
I want to create a table in MS SQL Server 2005 to record details
I want to create a table structure with checkbox for each row and each
i want to create a table : products which looks like (these are columns
I want to create some table through PHP but it fails everytime, but the
I want to create this table in Oracle. This is only the table SQL

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.