Page 68 - PYTHON-12
P. 68

y = 1


               z = 1

               print("Fibonacci series \n")

               print(x, y,end= " ")


               while(z<= i):

                   print(z, end=" ")

                   x = y


                   y = z

                   z = x + y




















               Program 6:  Write a Program to enter the string and to check if it’s palindrome or not using loop.


               Solution:

               # Program to enter the string and check if it’s palindrome or not using ‘for’ loop.

               msg=input("Enter any string : ")


               newlist=[]

               newlist[:0]=msg

               l=len(newlist)


               ed=l-1

               for i in range(0,l):
   63   64   65   66   67   68   69   70   71   72   73