Posts

python iterative and recursive program

  ITERATIVE AND  RECURSIVE  PROGRAM n = int ( input ( "Enter value : " )) def iterative ( n ):     for i in range ( n ):         fact = 1               fact = fact *( i + 1 )         return fact     pass n = int ( input ( "Enter the number : " )) print ( iterative ( n )) def func ( n ):     if n == 1 :         return 1     else :         return n * func ( n - 1 ) print ( "factorial number of " , func ( n ))

python code

 Gusses the number  print ( "Guess the number:" ) i = 0 while i < 9 :     i = i + 1     n = int ( input ( "enter a guess the number you think :" ))     if n > 18 :         print ( "guesses the number is the greater the value " , 9 - i)     elif n < 18 :         print ( "guesses the number is the less then value the value " , 9 - i)     elif n == 18 :         print ( "your guess is the right " )         break     else :         print ( "game is over " )