#add this code to your code and call "nextprime(number)" def nextprime(n): prime=0 n+=1 for i in range(2,int(n**0.5)+2): if n%i==0: prime=0 break else: prime=1 if prime==1: print(n) return else: nextprime(n) return
Here is what the above code is Doing:
1. It takes a number as input.
2. It checks if the number is prime or not.
3. If the number is prime, it prints the number and returns.
4. If the number is not prime, it calls the function again with the next number.
5. This process continues until a prime number is found.