Bottom Page

Thread Rating:
  • 3 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Python Finding Prime Factors
#1
code must read number from txt.file
a=104

i = 2
while i < a:
    if a % i == 0:
        print(i)
        a /= i
    else:
        i += 1
print(a)
Larz60+ wrote Jan-11-2019, 04:25 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Quote
#2
See Larz's note about tags. I changed the tags to python tags for you. Note that icode tags are only for inline code.

If you need to read from a file, the basic method is text = open(file_name).read().
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Prime number Python homework mkrisz98 11 259 May-10-2019, 05:23 PM
Last Post: mkrisz98
  Finding the end point of a path happylol123 1 107 Mar-31-2019, 09:55 AM
Last Post: Yoriz
  Finding Consonants? nlord7 1 139 Feb-28-2019, 03:20 AM
Last Post: ichabod801
  Help with finding vowels nlord7 1 139 Feb-27-2019, 04:40 AM
Last Post: ichabod801
  Finding and storing all string with character A at middle position Pippi 2 205 Jan-20-2019, 08:23 AM
Last Post: Pippi
  Finding Row Number for Items in 2D array fafzal 2 280 Jan-10-2019, 06:11 AM
Last Post: fafzal
  Prime numbers calculations frequency 3 323 Nov-27-2018, 07:07 PM
Last Post: micseydel
  Finding the Young's Modulues in a curve stress strain AicramM 1 312 Nov-03-2018, 09:01 PM
Last Post: Gribouillis
  Program that displays the number with the greatest amount of factors ilusmd 3 352 Nov-01-2018, 08:28 PM
Last Post: ichabod801
  finding the minimum value out of a set of inputs kannan 1 428 Oct-30-2018, 01:52 PM
Last Post: ichabod801

Forum Jump:


Users browsing this thread: 1 Guest(s)