# Rhythm Composer

## Rhythm Composer

Imagine D Iman, a famous music director to be composing a pop album. To create a unique composition, he decides to play only those keys of his instrument (consider every key has a number associated with it) which are divisible by one and itself (i.e. prime numbers). You may help him by writing a program in Python to print all the numbers that represent the keys he will need for his new composition – given the  interval [start,end] (start and end inclusive) within which he chooses the keys.   Write a user defined function to find out the key with prime numbers.

Note:

1. If start or end number is negative, then display the message “Invalid range”.
2. If there is not prime numbers between the starting and ending range, then display the message “There is no prime numbers in this range”.
3.  If the start and end numbers are same, then display the message “There is no prime numbers in this range”.
4. If the start number is greater than end number, then display the message “Invalid range”.
5. The function definition should be : find_prime(start,end) –  This function should take start and end number as parameters and return the prime numbers as a list.
6. Refer the sample input and output statements for more clarifications.

Input statement 1:

2

11

Output  statement 1:

2 3 5 7 11

Input statement 2:

3

-10

Output statement 2:

Invalid range

Input statement 3:

0

1

Output statement 3:

There is no prime numbers in this range

Input statement 4:

1

1

Output statement 4:

There is no prime numbers in this range

Input statement 5:

1

11

Output statement 5:

2 3 5 7 11

#### Code :-

```def find_prime(start,end):
count=0
for num in range(start_number,end_number+1):
if num>1:
for i in range(2,num):
if(num%i)==0:
break
else:
print(num,end=" ")
count=count+1
if count==0:
print("There is no prime numbers in this range")
start_number=int(input())
end_number=int(input())
if start_number<0 or end_number<0 or start_number>end_number:
print("Invalid range")
elif start_number==end_number:
print("There is no prime numbers in this range")
else:
find_prime(start_number,end_number)

```