Python Forum

Full Version: Turkish Character Prohibition
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]
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
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")
(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