“String Python Palindrome” Kode Jawaban

cara mencetak palindrome dalam 100 antara 250 dalam python

>>> def isPalindrome(s):
    ''' check if a number is a Palindrome '''
    s = str(s)
    return s == s[::-1]

>>> def generate_palindrome(minx,maxx):
    ''' return a list of Palindrome number in a given range '''
    tmpList = []
    for i in range(minx,maxx+1):
        if isPalindrome(i):
            tmpList.append(i)

    return tmpList

>>> generate_palindrome(1,120)

[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111]
Disgusted Dingo

Python Palindrome

def palindrome(a):
    return a == a[::-1]

palindrome('radar') 		# True
VasteMonde

kata palindrome python

mes=input("Enter the word and see if it is palindrome ")
if mes==mes[::-1]:
    print("This word is palindrome")
else:
    print("This word is not palindrome")
Zany Zebra

String Python Palindrome

s = "001100"

if s == s[::-1]:
    print("palindrome string")
else:
    print("Not a palindrome string.")
Excited Earthworm

Fungsi Python palindrome

bilangan = (5 % 3 ** 2) + (3 + 2 * 2) * (4 - 2) 
print(bilangan)
Shy Squirrel

Jawaban yang mirip dengan “String Python Palindrome”

Pertanyaan yang mirip dengan “String Python Palindrome”

Lebih banyak jawaban terkait untuk “String Python Palindrome” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya