From afe7fd2f65d9177298d5a928d97b533f528b8f83 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 11 Oct 2020 17:09:59 +0530 Subject: [PATCH] added python palindrome checking script --- .../GREATEST OF TWO NUMS.cpp | 36 +++++++++---------- python/check_palindrome.py | 13 +++++++ 2 files changed, 31 insertions(+), 18 deletions(-) rename GREATEST OF TWO NUMS.cpp => cpp/GREATEST OF TWO NUMS.cpp (94%) create mode 100644 python/check_palindrome.py diff --git a/GREATEST OF TWO NUMS.cpp b/cpp/GREATEST OF TWO NUMS.cpp similarity index 94% rename from GREATEST OF TWO NUMS.cpp rename to cpp/GREATEST OF TWO NUMS.cpp index 1e11cd4..550da48 100644 --- a/GREATEST OF TWO NUMS.cpp +++ b/cpp/GREATEST OF TWO NUMS.cpp @@ -1,18 +1,18 @@ -#include -#include -void great (int a,int b) -{ - if(a>b) -printf("\n A is greater Number."); -else -printf("\n B is greater Number."); - } - int main () - { - int a,b; - printf("Enter two numbers:"); - scanf(" %d %d", &a,&b); - great(a,b); - getch(); - return 0; - } +#include +#include +void great (int a,int b) +{ + if(a>b) +printf("\n A is greater Number."); +else +printf("\n B is greater Number."); + } + int main () + { + int a,b; + printf("Enter two numbers:"); + scanf(" %d %d", &a,&b); + great(a,b); + getch(); + return 0; + } diff --git a/python/check_palindrome.py b/python/check_palindrome.py new file mode 100644 index 0000000..1b71757 --- /dev/null +++ b/python/check_palindrome.py @@ -0,0 +1,13 @@ + +def check_palin(x): + k= x[::-1] + if(x==k): + return 1 + else: + return 0 +x=input("Enter a word") +out=check_palin(x) +if(out==1): + print(x," is a palindrome") +else: + print(x," is not a palindrome") \ No newline at end of file