# First we have to take input from the user num = input("Enter a number: ") # Now we have tor reverse the string num1 = num[::-1] # Checking if the reversed string is equal to original (Checking if its Palindrome) if (num==num1): # If condition true print print("The number is palindrome.") else: # If condition false print print("The number is not palindrome")
mystr = input("Enter to check if its Palindrome") if mystr[::-1].strip() == mystr.strip(): print("Yes It is a Plaindrome") else: print("No It is not a Plaindrome")
num = int(input("Enter the number: " )) listnum = list(map(int,str(num))) revlist = listnum[::-1] if listnum == revlist: print("The number is palindrome.") else: print("The number is not palindrome") #Bhai sabse asan tarika..using map and list slicing taught by you in other videos. So i tried this easiest way..How is it?
Bhai Kya ye program Jo aapne bnaya h wo theek h ..... Write a python program whether a string is palindrome or not? Is ques ka ans m Jo aapne likha h wo likh skta hu .....
The program was for beginners to make them understand how to deal with such problems. Although one liners are great but they make code unreadable for beginners/Intermediate programmers!
bhai kya yar bas 4 hi videos ? plz is playlist ko continue kro, But i aagree ap baki playlist me busy honge to hume accha source to bata do practise ka. plz badebhai.
print('Please enter number') number = int(input()) temp = number reverse = 0 while (number>0): dig = number%10 reverse = reverse *10 + dig number = number /10 if temp == reverse: print('Number is a Palindrome') else: print('Number is not a pallindrome') putting this code but always getting number is not a palindrome.. please help if possible
##to check a number for palindrome A=input() B=A[::-1] print(B) if A==B: print("the number is palindrome") else: print("the number is not a palindrome")
class PalindromeCheck: def __init__(self, number): self.number = number
def numberArrange(self): ls = [] n1 = self.number for item in str(self.number): ls.append(item)
ls.reverse() n = int("".join(ls)) return n, n1
def checkIt(self): func = self.numberArrange() original = func[1] new = func[0] if new == original: print("It is Palindrome") else: print("It is not Palindrome") if __name__ == "__main__": n = int(input("Enter a Number: ")) a = PalindromeCheck(n) a.checkIt()
# First we have to take input from the user
num = input("Enter a number: ")
# Now we have tor reverse the string
num1 = num[::-1]
# Checking if the reversed string is equal to original (Checking if its Palindrome)
if (num==num1):
# If condition true print
print("The number is palindrome.")
else:
# If condition false print
print("The number is not palindrome")
mystr = input("Enter to check if its Palindrome")
if mystr[::-1].strip() == mystr.strip():
print("Yes It is a Plaindrome")
else:
print("No It is not a Plaindrome")
please add more these kind of stuffs. thankyou harry
472 subs while makin it and now 624k awesome journey brother!!
Ossum bhai ek aur channel tha
2.37m
@@Impulsive-IM 3.3m
6.9 million🎉 bbby@@VanshGarg11
def is_palindrome(num):
temp=num
reverse=0
while(num>0):
dig=num%10
reverse=reverse*10+dig
num=num//10
return temp==reverse
num=int(input("Enter the Number:- "))
print(is_palindrome)
Extremely helpful, thank you very much!!
sir plz make a video about how we think about the logic.
Yes
Ye sab ka ek hi tarika h more of more examples solve kro
Uske liye maths Karo solve
so beautiful harry, you solved my querry, thank you so much for awesome video
Thankyou soo much harry bhai ,
Ek dum simple way mei explain karte ho aap
num = int(input("Enter the number:
" ))
listnum = list(map(int,str(num)))
revlist = listnum[::-1]
if listnum == revlist:
print("The number is palindrome.")
else:
print("The number is not palindrome")
#Bhai sabse asan tarika..using map and list slicing taught by you in other videos. So i tried this easiest way..How is it?
Bhai Kya ye program Jo aapne bnaya h wo theek h .....
Write a python program whether a string is palindrome or not?
Is ques ka ans m Jo aapne likha h wo likh skta hu .....
@@PRADEEPCHOUDHARY. ha bro
name = input()
reverse = name[::-1]
if name == reverse:
print("palindrome")
else:
print("not palindrome")
But what about a word containing one or two uppercase
a = input()
if a.lower()[::-1] == a.lower():
print('Palindrome')
else:
print('Not a Palindrome')
why to use lower() method ? value in integer how lower than anything to interger?
you had 735 subs that time, now its 6.1M. damn you cooked right
litterally when saw i was like wohho anyone can do it if he/she do hardwork and creates consistency
Video ke starting Mai 753 subscribers dikha rha tha... 2024 Mai 6.22M 🎉🎉
#PALLINDROME NUMBER
#STRING DATA TYPE
x=input("Enter your values : ")
reverse=x[ : : -1]
if x==reverse:
print("Pallindrome no." , "=" , x)
else:
print("NOT" , "=" , x)
U r great ❤️ Bhiya🤗
Sir we could also use string slicing
Bhai ke 735 subscribers the 5 years ago ab 4.5 million nice 💥💫
helped me a lot...thanks❣
At that time he has 735 subscribers and now he has crossed 3.8 million
Print("Harry Ki Jai")
and now 6.37 m
How about doing the operation in string or list
If x[::]==x[::-1] :
return true
else:
return false
santanu goswami
return x == x[ : :-1]
This was the first thing that came to my my mind.
The program was for beginners to make them understand how to deal with such problems. Although one liners are great but they make code unreadable for beginners/Intermediate programmers!
You are right this code is short
Bro but this will return False as If I input as Radar then it will reverse like radaR and will return its not palindrome.....
Can we do this with for loop?
wow 735 to 4 million subscribers maan gye guru ji
congratulations sir for 5.9 million and 6 million is counting ❤
us smay 735 subs the ab 5.73 mil. ek prakar ka palindrom hi hai.
Can we do this with string slicing?
bhai kya yar bas 4 hi videos ? plz is playlist ko continue kro, But i aagree ap baki playlist me busy honge to hume accha source to bata do practise ka. plz badebhai.
print('Please enter number')
number = int(input())
temp = number
reverse = 0
while (number>0):
dig = number%10
reverse = reverse *10 + dig
number = number /10
if temp == reverse:
print('Number is a Palindrome')
else:
print('Number is not a pallindrome')
putting this code but always getting number is not a palindrome.. please help if possible
in 8th line of your code you used \(division operator) but we are supposed to use \\(floor division)
🔥🔥🔥🔥🔥😍 fantastic
does not work for negative numbers. eg (-456)
##to check a number for palindrome
A=input()
B=A[::-1]
print(B)
if A==B:
print("the number is palindrome")
else:
print("the number is not a palindrome")
Nice👏😊
Nice explantation sir
sir plese sarre program dalliye jaise ki leap year,buzz factorial sare program ka video daliye
Nice👍
🔥
Keep updating the machine learning playlist
I will add a new video soon!
Thank you
Thanks uncle aunty
thanks bro
Can anyone please write this same code using for loop
lambda num: str(num) == str(num)[::-1]
If we want to find in a to z
Bhai pip nahi work kr raha
Cool
Damn, I gave a like and the like number became a palindrome number i.e., 535 xDDD
735 to 5.41 M ..
Harry op
👍🙏
you made it too complex
Help plz
First
waah!
ke ke bangladeshi
2024
class PalindromeCheck:
def __init__(self, number):
self.number = number
def numberArrange(self):
ls = []
n1 = self.number
for item in str(self.number):
ls.append(item)
ls.reverse()
n = int("".join(ls))
return n, n1
def checkIt(self):
func = self.numberArrange()
original = func[1]
new = func[0]
if new == original:
print("It is Palindrome")
else:
print("It is not Palindrome")
if __name__ == "__main__":
n = int(input("Enter a Number: "))
a = PalindromeCheck(n)
a.checkIt()
too complex
@@ShaheerAziz-f7e Brother, make it as short as possible
💻
what a growth