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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:05:00+00:00 2026-06-17T07:05:00+00:00

I have a simple python program After the division, it shows the end value

  • 0

I have a simple python program

After the division, it shows the end value but I want to not show the .01

from __future__ import division

number = int(133)
output = float(0)
divideNumber = int(1)

stop = false

while stop == false
   halfNumber = number / 2
  output =  number / divideNumber 
  output = round(output, 2)

  if ".0" in str(output):
    if "0.1" in str(output) or "0.2" in str(output ) or.... "0.9" in str(output): 
      #Do Nothing
  else: 
      #Do Nothing
    else: 
      print str(number) + " / " + divideNumber + " = "str(output)

  divideNumber += 1

  if divideNumber < halfNumber:
    break
  else: 
    #Do Nothing
print "Goodbye"

if I run it, this is the result:

133 / 1 = 133.0
133 / 7 = 19.0
133 / 11 = 12.09
133 / 12 = 11.08
133 / 19 = 7.0
133 / 22 = 6.05
133 / 33 = 4.03
133 / 43 = 3.09
133 / 44 = 3.02
133 / 64 = 2.08
133 / 65 = 2.05
133 / 66 = 2.02

Goodbye

My expected result is

 133 / 1 = 133.0
 133 / 7 = 19.0
 133 / 19 = 7.0
 Goodbye

Is my “if” statement wrong? I did not receive any errors!

  • 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-17T07:05:01+00:00Added an answer on June 17, 2026 at 7:05 am

    If I got you right, you need to skip all numbers with non-round numbers. This check should be something like:

    from math import floor
    
    if (output - floor(output))>0: # skip
        continue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple python program that I'd like to daemonize. Since the point
Well, i have written a simple python program that parses HTML with HTMLParser. Here
I have been trying to create a simple program with Python which uses OpenCV
I have written a simple python program l=[1,2,3,0,0,1] for i in range(0,len(l)): if l[i]==0:
I have a GUI python program and a simple error logging system via import
I'm working on windows vista, but I'm running python from DOS command. I have
I have one simple program of wsgi. from wsgiref.simple_server import make_server import time def
I have a simple python script (say, simple.py) , like a = 5 b
I have a simple Python script that uses a signal handler for Ctl-C. If
I have a simple python curses code that creates a subwindow. However, in the

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.