Python Forum
Turkish Character Prohibition - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Turkish Character Prohibition (/thread-22292.html)



Turkish Character Prohibition - JgKSuperstar - Nov-06-2019

Hi, i'm learning Python, but there are some places where I have problems. I would like to ban the use of Turkish characters. But Somewhere I'm making a mistake. How can I solve this problem?

My code :

tr_characters = "öçşüğıÖÇŞÜĞİ"
  
password = input("Please type in your password : ")

for control in password:
    if control in tr_characters:
        print("You can't use Turkish characters!")
        break
    else:
        print("Great password created")
        break
        

Error pic :

[url=[Image: lQXZGX.jpg]]Error Picture[/url]


RE: Turkish Character Prohibition - Cryptus - Nov-06-2019

import re

password = input("Please type in your password : ")

tr_characters = re.search("ö|ç|ş|ü|ğ|ı|Ö|Ç|Ş|Ü|Ğ|İ", password)

for control in password:
    if tr_characters:
        print("You can't use Turkish characters!")
        break
    else:
        print("Great password created")
        break



RE: Turkish Character Prohibition - buran - Nov-06-2019

tr_characters = "öçşüğıÖÇŞÜĞİ"
   
password = input("Please type in your password : ")
 
if any(ch in password for ch in tr_characters):
    print("You can't use Turkish characters!")
else:
    print("Great password created")



RE: Turkish Character Prohibition - JgKSuperstar - Nov-06-2019

(Nov-06-2019, 09:29 PM)Cryptus Wrote:
import re

password = input("Please type in your password : ")

tr_characters = re.search("ö|ç|ş|ü|ğ|ı|Ö|Ç|Ş|Ü|Ğ|İ", password)

for control in password:
    if tr_characters:
        print("You can't use Turkish characters!")
        break
    else:
        print("Great password created")
        break

Thank you very, very much. Pray Pray Pray

(Nov-06-2019, 09:33 PM)buran Wrote:
tr_characters = "öçşüğıÖÇŞÜĞİ"
   
password = input("Please type in your password : ")
 
if any(ch in password for ch in tr_characters):
    print("You can't use Turkish characters!")
else:
    print("Great password created")

Thank you very, very much. Pray Pray Pray