# Which of the following next palindrome - Fibonacci Python beginner project

This python project name is which of the following palindrome. In this project we find the given number of next palindrome, First we know about the palindrome definition.IN this project we does not use any module. Without using module we make which of the following next palindrome  project. Plaindrome number

What is palindrome?

The palindrome is the types of group of number, alphabet , data or binary which is similar from starts and ends such as level, stats, tenet, solo, refer, redder ,121, 565, 787, 56865 etc. This program helps to find the next palindrome from user input number

``````#codebugfree.com
#which of the following next palindrome python projects

def clau_palindrome(n): #fuction it is alsso knoe=ws as fuction decoraters
#if n is greater sigh here 10:#input number is less than 10 then return then number and print
#return n
#else:#matching a while lopp condition
n = n+1 #add +1 the n  number
while not search_nxt_palin(n):
n += 1#incriment the n with match the while loop condition
return n
def search_nxt_palin(n):#making while loop  condition

return str(n) == str(n)[::-1] #while loop condition
# Here it is main file
if __name__ =="__main__":
#grtting a user input
#lengh of word use in for range loop
user_choice = int(input("Enter a length of number"))
user_input_list = [] # empty list
for i in range (user_choice): #for loop range upto user choice input
user_input = int(input("Enter a number: ")) #getting a user input as anumber
user_input_list.append(user_input) # append empty list with user_input
print(user_input_list)#print a empty list

# two method for using for loop wit list comperrision
#for i in range(user_choice): #for loop for generating th next palindrome umber renge is user choice input
#    print(f"the next palindrome is {user_input_list[i]} = {clau_palindrome(user_input_list[i])}") #print using a f strings userinput insert a length and make a fuction

#listcompression
print(f" the next palindrome is{[user_input_list[i] if user_input_list[i]greater sigh here 10 else clau_palindrome(user_input_list[i]) for i in range(user_choice)]}")``````

In this program we use new features of python that is (if  __name__ =="__main__"). This new features is optional to use but other programming language like c ,java ,c++. It is automatically define but python has optional so, python is most popular now days. Input user length of number. How many words user have to find the next palindrome. Creating empty list. Starting a for loop range from 0 to input user length. Input user that numbers which user want to generate palindrome number. Append all number to empty list. again starting a for loop range there is most two for loop range with comprehension and without comprehension. Comprehension is one liner code hard to read and without comprehension increase line of the code but easy to read. All number is calu_palindrome function. ther is filter a number if number is lower than 10 they not go inside while loop they function return same value. If number is greater than 10  function pass to while loop to find Next palindrome. In while Loop There is condition  that is search_next_palin. While loop pass every value to search_next_palin function to matching the starts and ends with a similar number. They match and return the value

INOUTPUT

``````Enter a length of number: 10
Enter a number: 5
Enter a number: 8
Enter a number: 10
Enter a number: 4
Enter a number: 987
Enter a number: 57
Enter a number: 18907
Enter a number: 6098
Enter a number: 4556
Enter a number: 34
[5, 8, 10, 4, 987, 57, 18907, 6098, 4556, 34]
the next palindrome is[5, 8, 11, 4, 989, 66, 18981, 6116, 4664, 44]``````

This program is not capable to print next palindrome if that number is lower than11. Int this case you can edit that line n>10. IT is your practice Problem. When you finish Practice Problem Send me in comment.

### Program For Fibonacci Sequance

Fibonacci  is the sum of first and second number. IN Mathematics its is denoted by Fn. this program is eay to write, We does not use any types of module. Without module using makes this types of program. It is a python beginner projects.

``````#codebugfree.com
a = 0
b = 1
c = int()
for i in range(0,100):
if c >= 99:
break

c = a+b
a = b
b = c
print(c)``````

You can use must  comprehension it is your practice problem. If you use comprehension its reduce the line of the code.

INOUTPUT:

``````1
2
3
5
8
13
21
34
55
89
144``````