diff --git a/Ch2 - Basics/challange_start.py b/Ch2 - Basics/challange_start.py new file mode 100644 index 0000000..86d8a18 --- /dev/null +++ b/Ch2 - Basics/challange_start.py @@ -0,0 +1,32 @@ + +text="" + +def polidromtest(text): + y="" + + for x in text: + if x.isalnum(): + y=y+x + test=True + rev=y[::-1] + for i,b in enumerate(y): + + if rev[i]!=b: + print("Is palindrom:",False) + test=False + break + + if test: + print("Polindrom!") + + + + +while text != "exit": + + text =input ("Enter palindrome or 'exit':") + text=text.lower() + if text=="exit": + break + else: + polidromtest(text) diff --git a/Ch2 - Basics/conditionals_start.py b/Ch2 - Basics/conditionals_start.py index f6b58d6..e3648e6 100644 --- a/Ch2 - Basics/conditionals_start.py +++ b/Ch2 - Basics/conditionals_start.py @@ -6,14 +6,31 @@ def main(): - x, y = 10, 100 + x, y = 100, 100 # conditional flow uses if, elif, else + if x