Python Forum
Turkish Character Prohibition
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Turkish Character Prohibition
#1
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]
Reply
#2
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
Reply
#3
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")
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [solved] unexpected character after line continuation character paul18fr 4 3,294 Jun-22-2021, 03:22 PM
Last Post: deanhystad
  SyntaxError: unexpected character after line continuation character siteshkumar 2 3,110 Jul-13-2020, 07:05 PM
Last Post: snippsat
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 2,675 Jan-05-2020, 11:50 AM
Last Post: vivekagrey
  Replace changing string including uppercase character with lowercase character silfer 11 6,073 Mar-25-2019, 12:54 PM
Last Post: silfer
  SyntaxError: unexpected character after line continuation character Saka 2 18,475 Sep-26-2017, 09:34 AM
Last Post: Saka

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020