Python Forum
Help Editing/Problem with outputs
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Editing/Problem with outputs
#6
The if clause should go after line 35.

If you have the primes in a list p that is a global variable, you can just do:

def isPrime(i):
    return i in p
Note that if p is a set it will be faster than if p is a list. The set can use a hash lookup, while the list has to check each item in turn.
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, 04:37 PM

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