Python Forum
Help Editing/Problem with outputs
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Editing/Problem with outputs
#4
You could add:

if i < 2:
    return False
However, note that you are checking the same numbers over and over again to see whether they are prime. I would instead find all the primes up to 10000 and put them in a set. Then you can just check each number to see if it is in the set.

Also, you call find_maxPrimes (which gets the maximum getNumPrimes) and find_maxPrimes2 (which prints all the getNumPrimes), so you are calculating all of the getNumPrimes twice. If you just added the print statement from find_maxPrimes2 to find_maxPrimes, you do it all at the same time.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Help Editing/Problem with outputs - by stanthaman42 - Jul-10-2018, 09:28 PM
RE: Help Editing/Problem with outputs - by ichabod801 - Jul-11-2018, 01:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  format json outputs ! evilcode1 3 1,774 Oct-29-2023, 01:30 PM
Last Post: omemoe277
  Formatting outputs created with .join command klairel 2 645 Aug-23-2023, 08:52 AM
Last Post: perfringo
  Need help editing a PDF omar 4 1,092 Oct-22-2022, 08:52 PM
Last Post: Larz60+
  I have written a program that outputs data based on GPS signal kalle 1 1,195 Jul-22-2022, 12:10 AM
Last Post: mcmxl22
  Why does absence of print command outputs quotes in function? Mark17 2 1,413 Jan-04-2022, 07:08 PM
Last Post: ndc85430
Question Problem editing images ielcraft1 2 1,778 Dec-16-2021, 06:48 PM
Last Post: BashBedlam
  Thoughts on interfacing with a QR code reader that outputs keystrokes? wrybread 1 1,503 Oct-08-2021, 03:44 PM
Last Post: bowlofred
  Combining outputs into a dataframe rybina 0 1,696 Mar-15-2021, 02:43 PM
Last Post: rybina
  ONE input => THREE outputs Tricia279 6 2,701 Jan-14-2021, 08:52 AM
Last Post: perfringo
  Multi set string inputs/outputs kwmcgreal 2 2,100 Sep-26-2020, 10:44 PM
Last Post: kwmcgreal

Forum Jump:

User Panel Messages

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