Python Problem 4: Solution | Python Tutorials For Absolute Beginners In Hindi #110

►Full Python tutorials for absolute beginners (Hindi) playlist -
►Click here to subscribe -

Code as described/written in the video

Author: Harry
Date: 15 April 2019
Purpose: Practice Problem For CodeWithHarry Channel 

def next_palindrome(n):
    n = n+1
    while not is_palindrome(n):
        n += 1
    return n

def is_palindrome(n):
    return str(n) == str(n)[::-1]

if __name__ == "__main__":
    n = int(input("Enter the number of test cases\n"))
    numbers = []
    for i in range(n):
        number = int(input("Enter the number:\n"))

    for i in range(n):
            f"Next palindrome for {numbers[i]} is {next_palindrome(numbers[i])}")

Be the first person to comment!