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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:07:29+00:00 2026-05-14T14:07:29+00:00

I’m a very new python user (had only a little prior experience with html/javascript

  • 0

I’m a very new python user (had only a little prior experience with html/javascript as far as programming goes), and was trying to find some ways to output only intermittent numbers in my loop for a basic bicycle racing simulation (10,000 lines of biker positions would be pretty excessive :P).

I tried in this loop several ‘reasonable’ ways to communicate a condition where a floating point number equals its integer floor (int, floor division) to print out every 100 iterations or so:

 for i in range (0,10000):
  i = i + 1
  t = t + t_step #t is initialized at 0 while t_step is set at .01
  acceleration_rider1 = (power_rider1 / (70 * velocity_rider1)) - (force_drag1 / 70)
  velocity_rider1 = velocity_rider1 + (acceleration_rider1 * t_step)
  position_rider1 = position_rider1 + (velocity_rider1 * t_step)
  force_drag1 = area_rider1 * (velocity_rider1 ** 2) 
  acceleration_rider2 = (power_rider2 / (70 * velocity_rider1)) - (force_drag2 / 70)
  velocity_rider2 = velocity_rider2 + (acceleration_rider2 * t_step)
  position_rider2 = position_rider2 + (velocity_rider2 * t_step)
  force_drag2 = area_rider1 * (velocity_rider2 ** 2)

  if t == int(t): #TRIED t == t // 1 AND OTHER VARIANTS THAT DON'T WORK HERE:(
   print t, "biker 1", position_rider1, "m", "\t", "biker 2", position_rider2, "m" 
  • 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-05-14T14:07:30+00:00Added an answer on May 14, 2026 at 2:07 pm

    The for loop auto increments for you, so you don’t need to use i = i + 1.

    You don’t need t, just use % (modulo) operator to find multiples of a number.

    # Log every 1000 lines.
    LOG_EVERY_N = 1000
    
    for i in range(1000):
      ... # calculations with i
    
      if (i % LOG_EVERY_N) == 0:
        print "logging: ..."
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 407k
  • Answers 407k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You didn't define a constructor for the int value: package… May 15, 2026 at 6:23 am
  • Editorial Team
    Editorial Team added an answer This is quite simple: ServiceReference1.Service1Client client = new ConsoleApplication1.ServiceReference1.Service1Client(); client.ClientCredentials.UserName.UserName… May 15, 2026 at 6:23 am
  • Editorial Team
    Editorial Team added an answer You could replace the file writing methods with mock methods… May 15, 2026 at 6:23 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.