why this code is not giving any output | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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")

19th Aug 2021, 10:06 AM
Tarun
2 Respuestas
+ 5
The function prime is never called. You should call the function by the name: prime(num)
19th Aug 2021, 10:09 AM
Vadivelan
+ 4
Hi! you implemented all the functionality of the program in the form of a function. but you dont call the function anywhere else
19th Aug 2021, 10:10 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar