Python Forum
How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000
#4
Thanks guys however I'm trying to create a clean print though. This print job repeats, and with a little help at stackexcange along with my modification we got it to work. However, checkout the print feature. Can anyone help me with a single quality print here. Here is the code I have. Run it and see what it prints.

Also:

While I print using this python37 code it repeats till the end and its slow. I really need it to print super fast. Also I would like to divide the first number it finds before the colon and output the number that it is associated with after the colon.

For instance the program finds this ratio pair ( 8978:1445580) in the set after going through an amount of numbers and I decided to divide it like this 8978/8978 then the output should print (1445580). Or maybe it just matches 8978 and prints (1445580) as the output.

Is this possible? It does seem programmable, but my skills are a little weak in this area and I could use some help.

Thanks very much for any help! :)

Here is the code I'm working with:

while True:
    list_numbers={}
    a = int(input(' Enter 1st number for ratio calculation: '))
    b = int(input(' Enter 2nd number for ratio calculation: '))
    
    y = int(input(' Enter y start range: '))
    n = int(input(' Enter n end range: '))
    for x in range(y,n):
        list_numbers.update({a*x: b*x})
        print(list_numbers)
Reply


Messages In This Thread
RE: How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000 - by Pleiades - Nov-21-2019, 07:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Entry field random pull from list, each return own line Bear1981 6 741 Feb-25-2025, 06:09 AM
Last Post: Pedroski55
  python code to calculate mean of an array of numbers using numpy viren 3 1,172 May-29-2024, 04:49 PM
Last Post: Gribouillis
  what to return for an empty list Skaperen 2 1,148 May-24-2024, 05:17 PM
Last Post: Skaperen
  find random numbers that are = to the first 2 number of a list. Frankduc 23 7,019 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  List of random numbers astral_travel 17 5,618 Dec-02-2022, 10:37 PM
Last Post: deanhystad
  Remove numbers from a list menator01 4 3,632 Nov-13-2022, 01:27 AM
Last Post: menator01
  [split] why can't i create a list of numbers (ints) with random.randrange() astral_travel 7 2,781 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
  Divide a number by numbers in a list. Wallen 7 10,863 Feb-12-2022, 01:51 PM
Last Post: deanhystad
  Need to parse a list of boolean columns inside a list and return true values Python84 4 3,153 Jan-09-2022, 02:39 AM
Last Post: Python84
  producing numbers out of a list bouraque7878 10 5,687 Nov-12-2021, 09:13 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020