Python Prime Number For & While Loop
wap to create a function which display the factorial of five. def fact (n): if n == 0 : return 1 else : return n * fact(n - 1 ) print (fact( 3 )) also using whileeee loopp seee this # Factorial of 5 def fac (n): r= 1 i= 1 while i<=n: r=r*i i+= 1 return r print (fac( 3 )) wap to create a function for display n number of prime Numbers. def prime (n): c = 0 for i in range ( 1 , n + 1 ): if n % i == 0 : c += 1 if c == 2 : print ( "Its a Prime" ) else : print ( "compo" ) prime( 8 ) another method using while n = int ( input ( "Hello" )) c = 2 x = 0 while c < n: if n % c == 0 : x = 1 break c += 1 if x == 0 : print ( 'prim,' ) elif x == 1 : print ( "compo" ) def prime (n): c = 2 x = 0 while c < n: if n % c == 0 : x = 1 break c += 1 if x == 0 ...