write a function to find a string is symmetrical or palindrome in python| symmetrical and palindrome

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2024
  • #symmetrical #palindrome #pythonlogic #pythonlogicbuilding
    write a function to find a string is symmetrical or palindrome in python| symmetrical and palindrome
    Hellow friend i welcome you all in my coading channel.
    i hope you would like this video if you find the video best then please like and subscribe my channel.
    thank you for watching this video we will meet soon in the next video

ความคิดเห็น • 2

  • @aayushgautam4324
    @aayushgautam4324 2 ปีที่แล้ว

    i tried doing for aayu but its not printing symmetrical.
    i tried these inputs:
    a --> not symmetrical (printing)
    aa--> symmetrical (printing)
    aaa--> not symmetrical (printing)
    aayu--> (nothing is being printed)
    so this means even the characters need to be same ?
    my code:
    str=input("Enter a string to check whether symmitrical: ")
    size=len(str)
    if size%2==0:
    half=(size)//2
    if str[0:half]==str[half:size]:
    print("String is symmetrical")
    else:
    print("String is not symmetrical")
    is it that i misunderstood the question
    as well as ur code is wrong for the input --->madma

    • @bushra9985
      @bushra9985 ปีที่แล้ว

      str=input("Enter a string to check whether symmitrical: ")
      size=len(str)
      if size%2==0:
      half=(size)//2
      if str[0:half]==str[half:size]:
      print("String is symmetrical")
      else:
      print("String is not symmetrical")
      Enter a string to check whether symmitrical: aayu
      String is not symmetrical