0
why this code is not giving any output
num = int(input()) def prime(num): flag = False if num > 1: for i in range(2,num+1): if num % i ==0: flag = True break if flag is True: print(f"{num} is a prime") else: print(f"{num} is not a prime")
2 Antworten
+ 5
The function prime is never called. You should call the function by the name:
prime(num)
+ 4
Hi! you implemented all the functionality of the program in the form of a function. but you dont call the function anywhere else