In: Computer Science
1.
Write a python function that receives two positive numbers and displays the prime numbers between them.Note: A prime number (or a prime) is a natural number greater than 1 and that has no positive divisors other than 1 and itself.
2.
Using either Whileor Foriteration loops, write a python code that prints the first Nnumbers in Fibonacci Sequence, where N is inputted by the user. Now, revise this code to instead print a) the Nthnumber in Fibonacci Sequence.b) the summation of these N numbers in this sequence.
def is_prime(number): if(number <= 1): return False for x in range(2,number): if number%x == 0: return False return True def primesBetween(A,B): for i in range(A,B+1): if(is_prime(i)): print(i) # Testing primesBetween(5,15)
########################################
#Code.py N = int(input("Enter a number: ")) sum = 0 if N>0: if(N==1): print("the Nthnumber in Fibonacci Sequence:",0) if(N==2): print("the Nthnumber in Fibonacci Sequence:",1) sum += 1 if(N>=3): fold1 = 0 fold2 = 1 fnew = 1 for i in range(N-2): fold1 = fold2 fold2 = fnew fnew = fold1 + fold2 sum += fnew print("the Nthnumber in Fibonacci Sequence:", fnew) print("the summation of these N numbers in this sequence:",sum) else: print("Invalid input")