You might want to replace this with f'strings that looks like this: if int(len(primes)) in primes or int(len(primes)) in primes_2: You have a problem with indentation in this line: elif (x % i) = 1 and i = (x - 1):į-strings: if int(len(primes)) in primes or int(len(primes)) in primes_2: Print("Huh, fancy that!", len(primes), "is also also a prime number!") If int(len(primes)) in primes or int(len(primes)) in primes_2: Print("The number of prime numbers is: ", len(primes)) Print("1 isn't a prime number dumb dumb") High = int(input("What number would you like to go up to? ")) Low = int(input("What number would you like to start at? ")) I feel like this seems like a fairly long winded approach for something that's probably very simple, can someone please tell me how I can improve this? def prime_number(): It also tells you whether the number of primes is also a prime! I wrote some code to return how many prime numbers are in a specific range and what they are.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |