Python Forum
first k non prime numbers print
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
first k non prime numbers print
#4
You're looking at this the wrong way. Your goal is not to print the non-prime numbers. The printing is being done by the rest of the code. You need to trick the rest of the code into skipping the prime numbers. The generator is the first parameter to your function. If the generator is going to produce a prime number next, you need to call next(generator) to get it to skip that prime number.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
first k non prime numbers print - by bsrohith - Mar-01-2019, 07:44 AM
RE: first k non prime numbers print - by ichabod801 - Mar-01-2019, 04:35 PM
RE: first k non prime numbers print - by bsrohith - Mar-01-2019, 04:57 PM
RE: first k non prime numbers print - by ichabod801 - Mar-01-2019, 05:56 PM
RE: first k non prime numbers print - by bsrohith - Mar-01-2019, 06:41 PM
RE: first k non prime numbers print - by arycloud - Jun-20-2019, 08:40 AM
RE: first k non prime numbers print - by ichabod801 - Jun-20-2019, 10:31 AM
RE: first k non prime numbers print - by arycloud - Jun-20-2019, 10:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  prime numbers with iterator and generator cametan_001 8 1,970 Dec-17-2022, 02:41 PM
Last Post: cametan_001
  prime numbers astral_travel 28 3,903 Nov-08-2022, 09:23 PM
Last Post: astral_travel
  Print max numbers in a list jimmoriarty 1 2,186 Sep-25-2020, 07:29 AM
Last Post: DPaul
  Is there a way i print odd and even numbers separately? spalisetty06 5 2,789 Jul-21-2020, 06:48 PM
Last Post: spalisetty06
  Supposed to print out even numbers DallasPCMan 4 2,044 May-21-2020, 05:50 PM
Last Post: ndc85430
  Return prime numbers from range krzyfigh 2 1,974 Apr-20-2020, 08:08 PM
Last Post: krzyfigh
  Prime numbers Anderi02 1 2,009 Oct-13-2019, 04:49 PM
Last Post: ichabod801
  first k non-prime numbers arycloud 11 7,471 Jul-09-2019, 02:19 PM
Last Post: abhi19935
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,794 May-09-2019, 12:19 PM
Last Post: Pleiades
  Why can't I print numbers in Python? skrivver99 2 2,842 Nov-04-2018, 09:47 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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